Skip to content

Commit

Permalink
docs: Fix some typos (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktutnik committed Jan 20, 2023
1 parent cfda714 commit 6a1eae7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/reflect/readme.md
@@ -1,6 +1,6 @@
# Reflect: A JavScript/TypeScript Reflection Library
# Reflect: A JavaScript/TypeScript Reflection Library

A reflection library, extracts JavaScript/TypeScript object into an object graph containing object preferences and applied metadata information
A reflection library that extracts JavaScript/TypeScript object into an object graph containing object preferences and metadata information


## Companies Using Reflect
Expand Down
5 changes: 1 addition & 4 deletions packages/reflect/src/parser.ts
Expand Up @@ -60,7 +60,7 @@ function getNamesFromAst(nodes: any[]) {

function refineCode(fn: Class | Function, functionOnly = false) {

// some code may detected as invalid code, so its need to be fixed before parsed by acorn
// some code may detected as invalid code, so it needs to be fixed before it parsed by acorn
const code = fn.toString()

// for class created dynamically using reflect.create()
Expand All @@ -75,9 +75,6 @@ function refineCode(fn: Class | Function, functionOnly = false) {
// example
// const obj = { fn: function(par1) {} }
// reflect(obj.fn)
// regex search for
// /^(async\s+)?(function)\s*([a-zA-Z0-9_$]*)\s*\(([^)]*)\)\s*\{([^}]*)\}/

if (functionOnly && code.search(/^(async\s+)?(function)\s*\(([^)]*)\)\s*\{([^}]*)\}/gm) > -1)
return code.replace("function", "function _")

Expand Down

0 comments on commit 6a1eae7

Please sign in to comment.