run-objFun
Functions in running objects
install
# Install with npm$ npm install run-objfun --save# Install with yarn$ yarn add run-objfun# Install with bower$ bower install run-objfun --save
Usage
function is ES5 or ES6
const runObjFun =let arr =const fun1 = {arr}const fun2 = {arr}const obj =fun1fun2{arr}{arr}//=> trueconsole //=> [1, 2, 3, 4]
Skip non object
const runObjFun =let i = 0const fun1 = { // Run successfully++i}const fun2 = { // Run successfully++i}const generator1 = {++i}const array1 = 1 2 3const number1 = 123const regexp1 = /foo/const string1 = 'string'const bool1 = trueconst bool2 = falseconst undefined1 = undefinedconst null1 = nullconst obj =fun1fun2generator1array1number1regexp1string1bool1bool2undefined1null1//=> trueconsole //=> 2
Type judgment
const runObjFun =const arr =//=> false
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Commits | Contributor |
---|---|
7 | Black-Hole |
Author
Black-Hole
- Email:158blackhole@gmail.com
- Blog:http://bugs.cc
- WeiBo:http://weibo.com/comelove
- Twitter:https://twitter.com/Free_BlackHole