You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 8, 2020. It is now read-only.
> Parse a function or string that contains a function, using [babylon][] or [acorn][] parsers. By default it uses `babylon`, but you can pass custom one through `options.parser` option - for example pass `.parse: acorn.parse` to force use the `acorn` parser instead.
50
+
51
+
**Params**
52
+
53
+
*`code`**{Function|String}**: function to be parsed, it can be string too
54
+
*`options`**{Object}**: optional, passed directly to [babylon][] or [acorn][]; you can also pass custom `options.parser` parser
55
+
*`returns`**{Object}**: always returns an object, check `result.valid`
56
+
57
+
**Example**
58
+
59
+
```js
60
+
constacorn=require('acorn')
61
+
constacornLoose=require('acorn/dist/acorn_loose')
62
+
constparseFunction=require('parse-function')
63
+
64
+
constmyFn=functionabc (e, f, ...rest) { return1+ e +2+ f }
65
+
constparsed=parseFunction(myFn)
66
+
67
+
console.log(parsed.name) // => 'abc'
68
+
console.log(parsed.body) // => ' return 1 + e + 2 + f '
-[always-done](https://www.npmjs.com/package/always-done): Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement… [more](https://github.com/hybridables/always-done#readme) | [homepage](https://github.com/hybridables/always-done#readme"Handle completion and errors with elegance! Support for streams, callbacks, promises, child processes, async/await and sync functions. A drop-in replacement for [async-done][] - pass 100% of its tests plus more")
49
96
-[minibase](https://www.npmjs.com/package/minibase): Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing… [more](https://github.com/node-minibase/minibase#readme) | [homepage](https://github.com/node-minibase/minibase#readme"Minimalist alternative for Base. Build complex APIs with small units called plugins. Works well with most of the already existing [base][] plugins.")
@@ -124,3 +171,5 @@ _This file was generated by [verb-generate-readme](https://github.com/verbose/ve
0 commit comments