Package Exports
- is-empty-function
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-empty-function) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
is-empty-function

Checks the given function (or fn.toString()) is with empty body - dont have body.
Install
npm i is-empty-function --save
npm test
API
For more use-cases see the tests
isEmptyFunction
Check given function have empty body or not, and returns true or false.
[fn]
{Function|String} passed to parse-functionreturn
{Boolean}
Example:
var isEmptyFunction = require('is-empty-function')
var fixture = 'function() {};'
isEmptyFunction(fixture)
//=> true
var fixture = function named() {}
isEmptyFunction(fixture)
//=> true
var fixture = function() { return true }
isEmptyFunction(fixture)
//=> false
var fixture = function named() { return true }
isEmptyFunction(fixture)
//=> false
var fixture = "function codeCov() {__cov_Ejgcx$XN18CSfmeWn$f7vQ.f['2']++;};"
isEmptyFunction(fixture)
//=> true
Related
- cleanup-coverage-code: Cleanup ugly code added by code coverage tools during the test process. Like this one
__cov_Ejgcx$XN18CSfmeWn$f7vQ.f['2']++;
. - coverage-code-regex: Regular expression (regex) for matching ugly code that coverage tools add during the test process. Like this one
__cov_Ejgcx$XN18CSfmeWn$f7vQ.f['2']++;
- function-regex: Function regex. Regular expression for matching function parts. Expose match groups for function name, arguments and function body.
- hybridify: Building hybrid APIs. You can use both callback and promise in same time. Like
asyncFn(name, cb).then().catch()
- parse-function: Parse a given function or string (fn.toString()) to object with
name
,params
,parameters
,args
,arguments
andbody
properties.
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.