is-array-like-x
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"root": true, | ||
"extends": "@ljharb", | ||
"plugins": [ | ||
"import" | ||
], | ||
"rules": { | ||
"indent": ["error", 2, { | ||
"SwitchCase": 1 | ||
}], | ||
"global-require": 0, | ||
"max-params": 0, | ||
"block-scoped-var": 1 | ||
} | ||
} | ||
"extends": [ | ||
"@xotic750/eslint-config-standard-x" | ||
] | ||
} |
77
index.js
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/is-array-like-x" | ||
* title="Travis status"> | ||
* <img src="https://travis-ci.org/Xotic750/is-array-like-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-array-like-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-array-like-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-array-like-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-array-like-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/is-array-like-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/is-array-like-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* ES6 isArrayLike module. | ||
* | ||
* @version 1.2.0 | ||
* @file Determine if a value is array like. | ||
* @version 1.3.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -32,32 +10,25 @@ * @copyright Xotic750 | ||
/* eslint strict: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
var isNil = require('is-nil-x'); | ||
var isFunction = require('is-function-x'); | ||
var isLength = require('lodash.islength'); | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
var isNil = require('is-nil-x'); | ||
var isFunction = require('is-function-x'); | ||
var isLength = require('lodash.islength'); | ||
/** | ||
* Checks if value is array-like. A value is considered array-like if it's | ||
* not a function and has a `length` that's an integer greater than or | ||
* equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. | ||
* | ||
* @param {*} value The object to be tested. | ||
* @return {boolean} Returns `true` if subject is array-like, else `false`. | ||
* @example | ||
* var isArrayLike = require('is-array-like-x'); | ||
* | ||
* isArrayLike([1, 2, 3]); // true | ||
* isArrayLike(document.body.children); // true | ||
* isArrayLike('abc'); // true | ||
* isArrayLike(_.noop); // false | ||
*/ | ||
module.exports = function isArrayLike(value) { | ||
return !isNil(value) && !isFunction(value) && isLength(value.length); | ||
}; | ||
}()); | ||
/** | ||
* Checks if value is array-like. A value is considered array-like if it's | ||
* not a function and has a `length` that's an integer greater than or | ||
* equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. | ||
* | ||
* @param {*} value - The object to be tested. | ||
* @returns {boolean} Returns `true` if subject is array-like, else `false`. | ||
* @example | ||
* var isArrayLike = require('is-array-like-x'); | ||
* | ||
* isArrayLike([1, 2, 3]); // true | ||
* isArrayLike(document.body.children); // true | ||
* isArrayLike('abc'); // true | ||
* isArrayLike(_.noop); // false | ||
*/ | ||
module.exports = function isArrayLike(value) { | ||
return isNil(value) === false && isFunction(value) === false && isLength(value.length); | ||
}; |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/is-array-like-x" | ||
* title="Travis status"> | ||
* <img src="https://travis-ci.org/Xotic750/is-array-like-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-array-like-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-array-like-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-array-like-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-array-like-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/is-array-like-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/is-array-like-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* ES6 isArrayLike module. | ||
* | ||
* @version 1.2.0 | ||
* @file Determine if a value is array like. | ||
* @version 1.3.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -33,64 +11,31 @@ * @copyright Xotic750 | ||
/* eslint strict: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
var isNil = _dereq_('is-nil-x'); | ||
var isFunction = _dereq_('is-function-x'); | ||
var isLength = _dereq_('lodash.islength'); | ||
;(function () { // eslint-disable-line no-extra-semi | ||
/** | ||
* Checks if value is array-like. A value is considered array-like if it's | ||
* not a function and has a `length` that's an integer greater than or | ||
* equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. | ||
* | ||
* @param {*} value - The object to be tested. | ||
* @returns {boolean} Returns `true` if subject is array-like, else `false`. | ||
* @example | ||
* var isArrayLike = require('is-array-like-x'); | ||
* | ||
* isArrayLike([1, 2, 3]); // true | ||
* isArrayLike(document.body.children); // true | ||
* isArrayLike('abc'); // true | ||
* isArrayLike(_.noop); // false | ||
*/ | ||
module.exports = function isArrayLike(value) { | ||
return isNil(value) === false && isFunction(value) === false && isLength(value.length); | ||
}; | ||
'use strict'; | ||
var isNil = _dereq_('is-nil-x'); | ||
var isFunction = _dereq_('is-function-x'); | ||
var isLength = _dereq_('lodash.islength'); | ||
/** | ||
* Checks if value is array-like. A value is considered array-like if it's | ||
* not a function and has a `length` that's an integer greater than or | ||
* equal to 0 and less than or equal to `Number.MAX_SAFE_INTEGER`. | ||
* | ||
* @param {*} value The object to be tested. | ||
* @return {boolean} Returns `true` if subject is array-like, else `false`. | ||
* @example | ||
* var isArrayLike = require('is-array-like-x'); | ||
* | ||
* isArrayLike([1, 2, 3]); // true | ||
* isArrayLike(document.body.children); // true | ||
* isArrayLike('abc'); // true | ||
* isArrayLike(_.noop); // false | ||
*/ | ||
module.exports = function isArrayLike(value) { | ||
return !isNil(value) && !isFunction(value) && isLength(value.length); | ||
}; | ||
}()); | ||
},{"is-function-x":4,"is-nil-x":5,"lodash.islength":7}],2:[function(_dereq_,module,exports){ | ||
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/has-symbol-support-x" | ||
* title="Travis status"> | ||
* <img | ||
* src="https://travis-ci.org/Xotic750/has-symbol-support-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/has-symbol-support-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/has-symbol-support-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a | ||
* href="https://david-dm.org/Xotic750/has-symbol-support-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/has-symbol-support-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/has-symbol-support-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/has-symbol-support-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* Tests if `Symbol` exists and creates the correct type. | ||
* | ||
* Requires ES3 or above. | ||
* | ||
* @version 1.2.0 | ||
* @file Tests if ES6 Symbol is supported. | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -102,51 +47,17 @@ * @copyright Xotic750 | ||
/* eslint strict: 1, symbol-description: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
/** | ||
* Indicates if `Symbol`exists and creates the correct type. | ||
* `true`, if it exists and creates the correct type, otherwise `false`. | ||
* | ||
* @type boolean | ||
*/ | ||
module.exports = typeof Symbol === 'function' && typeof Symbol('') === 'symbol'; | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
/** | ||
* Indicates if `Symbol`exists and creates the correct type. | ||
* `true`, if it exists and creates the correct type, otherwise `false`. | ||
* | ||
* @type boolean | ||
*/ | ||
module.exports = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
}()); | ||
},{}],3:[function(_dereq_,module,exports){ | ||
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/has-to-string-tag-x" | ||
* title="Travis status"> | ||
* <img | ||
* src="https://travis-ci.org/Xotic750/has-to-string-tag-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/has-to-string-tag-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/has-to-string-tag-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a | ||
* href="https://david-dm.org/Xotic750/has-to-string-tag-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/has-to-string-tag-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/has-to-string-tag-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/has-to-string-tag-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* Tests if ES6 @@toStringTag is supported. | ||
* | ||
* Requires ES3 or above. | ||
* | ||
* @file Tests if ES6 @@toStringTag is supported. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-@@tostringtag|26.3.1 @@toStringTag} | ||
* | ||
* @version 1.2.0 | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -158,47 +69,16 @@ * @copyright Xotic750 | ||
/* eslint strict: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
/** | ||
* Indicates if `Symbol.toStringTag`exists and is the correct type. | ||
* `true`, if it exists and is the correct type, otherwise `false`. | ||
* | ||
* @type boolean | ||
*/ | ||
module.exports = _dereq_('has-symbol-support-x') && typeof Symbol.toStringTag === 'symbol'; | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
/** | ||
* Indicates if `Symbol.toStringTag`exists and is the correct type. | ||
* `true`, if it exists and is the correct type, otherwise `false`. | ||
* | ||
* @type boolean | ||
*/ | ||
module.exports = _dereq_('has-symbol-support-x') && typeof Symbol.toStringTag === 'symbol'; | ||
}()); | ||
},{"has-symbol-support-x":2}],4:[function(_dereq_,module,exports){ | ||
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/is-function-x" | ||
* title="Travis status"> | ||
* <img | ||
* src="https://travis-ci.org/Xotic750/is-function-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-function-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-function-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a | ||
* href="https://david-dm.org/Xotic750/is-function-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-function-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/is-function-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/is-function-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* Determine whether a given value is a function object. | ||
* | ||
* @version 1.2.0 | ||
* @file Determine whether a given value is a function object. | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -210,93 +90,89 @@ * @copyright Xotic750 | ||
/* eslint strict: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
var fToString = Function.prototype.toString; | ||
var toStringTag = _dereq_('to-string-tag-x'); | ||
var hasToStringTag = _dereq_('has-to-string-tag-x'); | ||
var isPrimitive = _dereq_('is-primitive'); | ||
var funcTag = '[object Function]'; | ||
var genTag = '[object GeneratorFunction]'; | ||
var asyncTag = '[object AsyncFunction]'; | ||
;(function () { // eslint-disable-line no-extra-semi | ||
var constructorRegex = /^\s*class /; | ||
var isES6ClassFn = function isES6ClassFunc(value) { | ||
try { | ||
var fnStr = fToString.call(value); | ||
var singleStripped = fnStr.replace(/\/\/.*\n/g, ''); | ||
var multiStripped = singleStripped.replace(/\/\*[.\s\S]*\*\//g, ''); | ||
var spaceStripped = multiStripped.replace(/\n/mg, ' ').replace(/ {2}/g, ' '); | ||
return constructorRegex.test(spaceStripped); | ||
} catch (ignore) {} | ||
'use strict'; | ||
return false; // not a function | ||
}; | ||
var fToString = Function.prototype.toString; | ||
var toStringTag = _dereq_('to-string-tag-x'); | ||
var hasToStringTag = _dereq_('has-to-string-tag-x'); | ||
var isPrimitive = _dereq_('is-primitive'); | ||
var funcTag = '[object Function]'; | ||
var genTag = '[object GeneratorFunction]'; | ||
var asyncTag = '[object AsyncFunction]'; | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @private | ||
* @param {*} value - The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
*/ | ||
var tryFuncToString = function funcToString(value) { | ||
try { | ||
if (isES6ClassFn(value)) { | ||
return false; | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @return {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
*/ | ||
var tryFuncToString = function funcToString(value) { | ||
try { | ||
fToString.call(value); | ||
return true; | ||
} catch (ignore) {} | ||
fToString.call(value); | ||
return true; | ||
} catch (ignore) {} | ||
return false; | ||
}; | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @param {*} value - The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
* var isFunction = require('is-function-x'); | ||
* | ||
* isFunction(); // false | ||
* isFunction(Number.MIN_VALUE); // false | ||
* isFunction('abc'); // false | ||
* isFunction(true); // false | ||
* isFunction({ name: 'abc' }); // false | ||
* isFunction(function () {}); // true | ||
* isFunction(new Function ()); // true | ||
* isFunction(function* test1() {}); // true | ||
* isFunction(function test2(a, b) {}); // true | ||
- isFunction(async function test3() {}); // true | ||
* isFunction(class Test {}); // false | ||
* isFunction((x, y) => {return this;}); // true | ||
*/ | ||
module.exports = function isFunction(value) { | ||
if (isPrimitive(value)) { | ||
return false; | ||
}; | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @param {*} value The value to check. | ||
* @return {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
* var isFunction = require('is-function-x'); | ||
* | ||
* isFunction(); // false | ||
* isFunction(Number.MIN_VALUE); // false | ||
* isFunction('abc'); // false | ||
* isFunction(true); // false | ||
* isFunction({ name: 'abc' }); // false | ||
* isFunction(function () {}); // true | ||
* isFunction(new Function ()); // true | ||
* isFunction(function* test1() {}); // true | ||
* isFunction(function test2(a, b) {}); // true | ||
* isFunction(class Test {}); // true | ||
* isFunction((x, y) => {return this;}); // true | ||
*/ | ||
module.exports = function isFunction(value) { | ||
if (isPrimitive(value)) { | ||
return false; | ||
} | ||
if (hasToStringTag) { | ||
return tryFuncToString(value); | ||
} | ||
var strTag = toStringTag(value); | ||
return strTag === funcTag || strTag === genTag || strTag === asyncTag; | ||
}; | ||
}()); | ||
if (hasToStringTag) { | ||
return tryFuncToString(value); | ||
} | ||
if (isES6ClassFn(value)) { | ||
return false; | ||
} | ||
var strTag = toStringTag(value); | ||
return strTag === funcTag || strTag === genTag || strTag === asyncTag; | ||
}; | ||
},{"has-to-string-tag-x":3,"is-primitive":6,"to-string-tag-x":9}],5:[function(_dereq_,module,exports){ | ||
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/is-nil-x" | ||
* title="Travis status"> | ||
* <img src="https://travis-ci.org/Xotic750/is-nil-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-nil-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-nil-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/is-nil-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/is-nil-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/is-nil-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/is-nil-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* Checks if `value` is `null` or `undefined`. | ||
* | ||
* @version 1.2.0 | ||
* @file Checks if `value` is `null` or `undefined`. | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -308,34 +184,23 @@ * @copyright Xotic750 | ||
/* eslint strict: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
var isUndefined = _dereq_('validate.io-undefined'); | ||
var isNull = _dereq_('lodash.isnull'); | ||
;(function () { // eslint-disable-line no-extra-semi | ||
/** | ||
* Checks if `value` is `null` or `undefined`. | ||
* | ||
* @param {*} value - The value to check. | ||
* @returns {boolean} Returns `true` if `value` is nullish, else `false`. | ||
* @example | ||
* var isNil = require('is-nil-x'); | ||
* | ||
* isNil(null); // => true | ||
* isNil(void 0); // => true | ||
* isNil(NaN); // => false | ||
*/ | ||
module.exports = function isNil(value) { | ||
return isNull(value) || isUndefined(value); | ||
}; | ||
'use strict'; | ||
var isUndefined = _dereq_('validate.io-undefined'); | ||
var isNull = _dereq_('lodash.isnull'); | ||
/** | ||
* Checks if `value` is `null` or `undefined`. | ||
* | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is nullish, else `false`. | ||
* @example | ||
* | ||
* _.isNil(null); | ||
* // => true | ||
* | ||
* _.isNil(void 0); | ||
* // => true | ||
* | ||
* _.isNil(NaN); | ||
* // => false | ||
*/ | ||
module.exports = function isNil(value) { | ||
return isNull(value) || isUndefined(value); | ||
}; | ||
}()); | ||
},{"lodash.isnull":8,"validate.io-undefined":10}],6:[function(_dereq_,module,exports){ | ||
@@ -434,30 +299,5 @@ /*! | ||
/** | ||
* @file | ||
* <a href="https://travis-ci.org/Xotic750/to-string-tag-x" | ||
* title="Travis status"> | ||
* <img src="https://travis-ci.org/Xotic750/to-string-tag-x.svg?branch=master" | ||
* alt="Travis status" height="18"> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/to-string-tag-x" | ||
* title="Dependency status"> | ||
* <img src="https://david-dm.org/Xotic750/to-string-tag-x.svg" | ||
* alt="Dependency status" height="18"/> | ||
* </a> | ||
* <a href="https://david-dm.org/Xotic750/to-string-tag-x#info=devDependencies" | ||
* title="devDependency status"> | ||
* <img src="https://david-dm.org/Xotic750/to-string-tag-x/dev-status.svg" | ||
* alt="devDependency status" height="18"/> | ||
* </a> | ||
* <a href="https://badge.fury.io/js/to-string-tag-x" title="npm version"> | ||
* <img src="https://badge.fury.io/js/to-string-tag-x.svg" | ||
* alt="npm version" height="18"> | ||
* </a> | ||
* | ||
* Get an object's ES6 @@toStringTag. | ||
* | ||
* Requires ES3 or above. | ||
* | ||
* @file Get an object's ES6 @@toStringTag. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring|19.1.3.6 Object.prototype.toString ( )} | ||
* | ||
* @version 1.2.0 | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -469,38 +309,32 @@ * @copyright Xotic750 | ||
/* eslint strict: 1 */ | ||
'use strict'; | ||
/* global module */ | ||
var isNull = _dereq_('lodash.isnull'); | ||
var isUndefined = _dereq_('validate.io-undefined'); | ||
var toStr = Object.prototype.toString; | ||
;(function () { // eslint-disable-line no-extra-semi | ||
/** | ||
* The `toStringTag` method returns "[object type]", where type is the | ||
* object type. | ||
* | ||
* @param {*} value - The object of which to get the object type string. | ||
* @returns {string} The object type string. | ||
* @example | ||
* var toStringTag = require('to-string-tag-x'); | ||
* | ||
* var o = new Object(); | ||
* toStringTag(o); // returns '[object Object]' | ||
*/ | ||
module.exports = function toStringTag(value) { | ||
if (isNull(value)) { | ||
return '[object Null]'; | ||
} | ||
'use strict'; | ||
if (isUndefined(value)) { | ||
return '[object Undefined]'; | ||
} | ||
var isNull = _dereq_('lodash.isnull'); | ||
var isUndefined = _dereq_('validate.io-undefined'); | ||
var nullTag = '[object Null]'; | ||
var undefTag = '[object Undefined]'; | ||
var toStr = Object.prototype.toString; | ||
return toStr.call(value); | ||
}; | ||
/** | ||
* The `toStringTag` method returns "[object type]", where type is the | ||
* object type. | ||
* | ||
* @param {*} value The object of which to get the object type string. | ||
* @return {string} The object type string. | ||
* @example | ||
* var o = new Object(); | ||
* | ||
* toStringTag(o); // returns '[object Object]' | ||
*/ | ||
module.exports = function toStringTag(value) { | ||
if (isNull(value)) { | ||
return nullTag; | ||
} | ||
if (isUndefined(value)) { | ||
return undefTag; | ||
} | ||
return toStr.call(value); | ||
}; | ||
}()); | ||
},{"lodash.isnull":8,"validate.io-undefined":10}],10:[function(_dereq_,module,exports){ | ||
@@ -507,0 +341,0 @@ /** |
@@ -1,2 +0,51 @@ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.returnExports=t()}}(function(){return function e(t,n,i){function s(r,u){if(!n[r]){if(!t[r]){var f="function"==typeof require&&require;if(!u&&f)return f(r,!0);if(o)return o(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[r]={exports:{}};t[r][0].call(l.exports,function(n){var e=t[r][1][n];return s(e||n)},l,l.exports,e,t,n,i)}return n[r].exports}for(var o="function"==typeof require&&require,r=0;r<i.length;r++)s(i[r]);return s}({1:[function(t,n,e){!function(){"use strict";var e=t("is-nil-x"),i=t("is-function-x"),o=t("lodash.islength");n.exports=function isArrayLike(t){return!e(t)&&!i(t)&&o(t.length)}}()},{"is-function-x":4,"is-nil-x":5,"lodash.islength":7}],2:[function(t,n,e){!function(){"use strict";n.exports="function"==typeof Symbol&&"symbol"==typeof Symbol()}()},{}],3:[function(t,n,e){!function(){"use strict";n.exports=t("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag}()},{"has-symbol-support-x":2}],4:[function(t,n,e){!function(){"use strict";var e=Function.prototype.toString,i=t("to-string-tag-x"),o=t("has-to-string-tag-x"),r=t("is-primitive"),u=function funcToString(t){try{return e.call(t),!0}catch(t){}return!1};n.exports=function isFunction(t){if(r(t))return!1;if(o)return u(t);var n=i(t);return"[object Function]"===n||"[object GeneratorFunction]"===n||"[object AsyncFunction]"===n}}()},{"has-to-string-tag-x":3,"is-primitive":6,"to-string-tag-x":9}],5:[function(t,n,e){!function(){"use strict";var e=t("validate.io-undefined"),i=t("lodash.isnull");n.exports=function isNil(t){return i(t)||e(t)}}()},{"lodash.isnull":8,"validate.io-undefined":10}],6:[function(t,n,e){"use strict";n.exports=function isPrimitive(t){return null==t||"function"!=typeof t&&"object"!=typeof t}},{}],7:[function(t,n,e){function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}var i=9007199254740991;n.exports=isLength},{}],8:[function(t,n,e){function isNull(t){return null===t}n.exports=isNull},{}],9:[function(t,n,e){!function(){"use strict";var e=t("lodash.isnull"),i=t("validate.io-undefined"),o=Object.prototype.toString;n.exports=function toStringTag(t){return e(t)?"[object Null]":i(t)?"[object Undefined]":o.call(t)}}()},{"lodash.isnull":8,"validate.io-undefined":10}],10:[function(t,n,e){"use strict";function isUndefined(t){return void 0===t}n.exports=isUndefined},{}]},{},[1])(1)}); | ||
//# sourceMappingURL=lib/is-array-like-x.map | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).returnExports=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(_dereq_,module,exports){/** | ||
* @file Determine if a value is array like. | ||
* @version 1.3.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module is-array-like-x | ||
*/ | ||
"use strict";var isNil=_dereq_("is-nil-x"),isFunction=_dereq_("is-function-x"),isLength=_dereq_("lodash.islength");module.exports=function isArrayLike(value){return!1===isNil(value)&&!1===isFunction(value)&&isLength(value.length)}},{"is-function-x":4,"is-nil-x":5,"lodash.islength":7}],2:[function(_dereq_,module,exports){/** | ||
* @file Tests if ES6 Symbol is supported. | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module has-symbol-support-x | ||
*/ | ||
"use strict";module.exports="function"==typeof Symbol&&"symbol"==typeof Symbol("")},{}],3:[function(_dereq_,module,exports){/** | ||
* @file Tests if ES6 @@toStringTag is supported. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-@@tostringtag|26.3.1 @@toStringTag} | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module has-to-string-tag-x | ||
*/ | ||
"use strict";module.exports=_dereq_("has-symbol-support-x")&&"symbol"==typeof Symbol.toStringTag},{"has-symbol-support-x":2}],4:[function(_dereq_,module,exports){/** | ||
* @file Determine whether a given value is a function object. | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module is-function-x | ||
*/ | ||
"use strict";var fToString=Function.prototype.toString,toStringTag=_dereq_("to-string-tag-x"),hasToStringTag=_dereq_("has-to-string-tag-x"),isPrimitive=_dereq_("is-primitive"),constructorRegex=/^\s*class /,isES6ClassFn=function isES6ClassFunc(value){try{var spaceStripped=fToString.call(value).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return constructorRegex.test(spaceStripped)}catch(ignore){}return!1},tryFuncToString=function funcToString(value){try{return!isES6ClassFn(value)&&(fToString.call(value),!0)}catch(ignore){}return!1};module.exports=function isFunction(value){if(isPrimitive(value))return!1;if(hasToStringTag)return tryFuncToString(value);if(isES6ClassFn(value))return!1;var strTag=toStringTag(value);return"[object Function]"===strTag||"[object GeneratorFunction]"===strTag||"[object AsyncFunction]"===strTag}},{"has-to-string-tag-x":3,"is-primitive":6,"to-string-tag-x":9}],5:[function(_dereq_,module,exports){/** | ||
* @file Checks if `value` is `null` or `undefined`. | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module is-nil-x | ||
*/ | ||
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":8,"validate.io-undefined":10}],6:[function(_dereq_,module,exports){"use strict";module.exports=function isPrimitive(value){return null==value||"function"!=typeof value&&"object"!=typeof value}},{}],7:[function(_dereq_,module,exports){var MAX_SAFE_INTEGER=9007199254740991;module.exports=function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}},{}],8:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],9:[function(_dereq_,module,exports){/** | ||
* @file Get an object's ES6 @@toStringTag. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring|19.1.3.6 Object.prototype.toString ( )} | ||
* @version 1.4.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module to-string-tag-x | ||
*/ | ||
"use strict";var isNull=_dereq_("lodash.isnull"),isUndefined=_dereq_("validate.io-undefined"),toStr=Object.prototype.toString;module.exports=function toStringTag(value){return isNull(value)?"[object Null]":isUndefined(value)?"[object Undefined]":toStr.call(value)}},{"lodash.isnull":8,"validate.io-undefined":10}],10:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}]},{},[1])(1)}); |
{ | ||
"name": "is-array-like-x", | ||
"version": "1.2.0", | ||
"description": "ES6 isArrayLike module.", | ||
"version": "1.3.0", | ||
"description": "Determine if a value is array like.", | ||
"homepage": "https://github.com/Xotic750/is-array-like-x", | ||
@@ -12,3 +12,2 @@ "author": { | ||
"keywords": [ | ||
"es6", | ||
"isArrayLike", | ||
@@ -33,37 +32,59 @@ "module", | ||
"dependencies": { | ||
"is-nil-x": "^1.2.0", | ||
"is-function-x": "^1.2.0", | ||
"is-nil-x": "^1.4.0", | ||
"is-function-x": "^1.4.0", | ||
"lodash.islength": "^4.0.1" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^11.0.0", | ||
"browserify": "^14.1.0", | ||
"@xotic750/eslint-config-standard-x": "^2.2.1", | ||
"browserify": "^14.4.0", | ||
"browserify-derequire": "^0.9.4", | ||
"cross-env": "^5.0.1", | ||
"es5-shim": "^4.5.9", | ||
"es6-shim": "^0.35.3", | ||
"es7-shim": "^6.0.0", | ||
"eslint": "^3.18.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint": "^4.2.0", | ||
"eslint-plugin-compat": "^1.0.4", | ||
"eslint-plugin-css-modules": "^2.7.2", | ||
"eslint-plugin-eslint-comments": "^1.0.2", | ||
"eslint-plugin-jsdoc": "^3.1.1", | ||
"eslint-plugin-json": "^1.2.0", | ||
"eslint-plugin-no-use-extend-native": "^0.3.12", | ||
"husky": "^0.13.4", | ||
"jasmine-node": "^1.14.5", | ||
"jsdoc-to-markdown": "^3.0.0", | ||
"json3": "^3.3.2", | ||
"make-jasmine-spec-runner-html": "^1.1.0", | ||
"make-jasmine-spec-runner-html": "^1.3.0", | ||
"ncp": "^2.0.0", | ||
"nodemon": "^1.11.0", | ||
"nsp": "^2.6.3", | ||
"replace-x": "^1.1.1", | ||
"uglify-js": "^2.8.18" | ||
"parallelshell": "^3.0.1", | ||
"replace-x": "^1.5.0", | ||
"rimraf": "^2.6.1", | ||
"serve": "^6.0.2", | ||
"uglify-js": "^3.0.24" | ||
}, | ||
"scripts": { | ||
"build": "npm run build:setver && npm run security && npm run eslint && npm run browserify && npm run uglify && npm run docs && npm run build:jasmine && npm test", | ||
"build:jasmine": "make-jasmine-spec-runner-html", | ||
"build:setver": "PKG_VER=$(node -p -e \"require('./package.json').version\") && replace-x \" @version .*\" \" @version ${PKG_VER}\" index.js", | ||
"build:watch": "nodemon --watch index.js --watch package.json --exec 'npm run build'", | ||
"docs": "jsdoc2md --name-format --example-lang js index.js > README.md", | ||
"eslint": "eslint *.js tests/spec/*.js", | ||
"clean": "rimraf README.md lib/*", | ||
"clean:jasmine": "rimraf tests/index.html tests/run.js", | ||
"clean:all": "npm run clean:jasmine && npm run clean", | ||
"build": "npm run clean && npm run lint && npm run browserify && npm run uglify && npm run docs && npm test && npm run security", | ||
"build:jasmine": "npm run clean:jasmine && make-jasmine-spec-runner-html", | ||
"build:setver": "replace-x \" @version .*\" \" @version $(node -p -e \"require('./package.json').version\")\" index.js", | ||
"build:name": "replace-x \" @module .*\" \" @module $(node -p -e \"require('./package.json').name\")\" index.js", | ||
"build:description": "replace-x \" @file .*\" \" @file $(node -p -e \"require('./package.json').description\")\" index.js", | ||
"build:replace": "npm run build:setver && npm run build:name && npm run build:description", | ||
"production": "npm run clean:all && npm run build:jasmine && npm run build:replace && npm run build", | ||
"start": "parallelshell \"serve\" \"nodemon --watch index.js --exec 'npm run build'\"", | ||
"docs:name": "replace-x \"@{PACKAGE-NAME}\" \"$(node -p -e \"require('./package.json').name\")\" README.md", | ||
"docs:badges": "ncp badges.html README.md && npm run docs:name", | ||
"docs": "npm run docs:badges && jsdoc2md --name-format --example-lang js index.js >> README.md", | ||
"lint": "eslint *.js tests/spec/*.js", | ||
"lint-fix": "npm run lint -- --fix", | ||
"security": "nsp check", | ||
"test": "jasmine-node --matchall tests/spec/", | ||
"test:watch": "nodemon --watch tests/spec/test.js --exec 'npm test'", | ||
"browserify": "browserify -p browserify-derequire -e index.js -o lib/is-array-like-x.js -u 'crypto' -s returnExports", | ||
"uglify": "uglifyjs lib/is-array-like-x.js -o lib/is-array-like-x.min.js --compress --keep-fnames --mangle --beautify ascii_only=true,beautify=false --source-map lib/is-array-like-x.map" | ||
"uglify": "uglifyjs lib/is-array-like-x.js -o lib/is-array-like-x.min.js --config-file .uglifyjsrc.json", | ||
"precommit": "npm run production", | ||
"prepush": "npm run production" | ||
} | ||
} |
@@ -1,27 +0,27 @@ | ||
<a name="module_is-array-like-x"></a> | ||
## is-array-like-x | ||
<a href="https://travis-ci.org/Xotic750/is-array-like-x" | ||
title="Travis status"> | ||
<img src="https://travis-ci.org/Xotic750/is-array-like-x.svg?branch=master" | ||
alt="Travis status" height="18"> | ||
title="Travis status"> | ||
<img | ||
src="https://travis-ci.org/Xotic750/is-array-like-x.svg?branch=master" | ||
alt="Travis status" height="18"/> | ||
</a> | ||
<a href="https://david-dm.org/Xotic750/is-array-like-x" | ||
title="Dependency status"> | ||
title="Dependency status"> | ||
<img src="https://david-dm.org/Xotic750/is-array-like-x.svg" | ||
alt="Dependency status" height="18"/> | ||
alt="Dependency status" height="18"/> | ||
</a> | ||
<a href="https://david-dm.org/Xotic750/is-array-like-x#info=devDependencies" | ||
title="devDependency status"> | ||
title="devDependency status"> | ||
<img src="https://david-dm.org/Xotic750/is-array-like-x/dev-status.svg" | ||
alt="devDependency status" height="18"/> | ||
alt="devDependency status" height="18"/> | ||
</a> | ||
<a href="https://badge.fury.io/js/is-array-like-x" title="npm version"> | ||
<img src="https://badge.fury.io/js/is-array-like-x.svg" | ||
alt="npm version" height="18"> | ||
alt="npm version" height="18"/> | ||
</a> | ||
<a name="module_is-array-like-x"></a> | ||
ES6 isArrayLike module. | ||
## is-array-like-x | ||
Determine if a value is array like. | ||
**Version**: 1.2.0 | ||
**Version**: 1.3.0 | ||
**Author**: Xotic750 <Xotic750@gmail.com> | ||
@@ -28,0 +28,0 @@ **License**: [MIT](<https://opensource.org/licenses/MIT>) |
@@ -1,98 +0,97 @@ | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
'use strict'; | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:true, esnext:true, plusplus:true, maxparams:1, maxdepth:2, | ||
maxstatements:11, maxcomplexity:3 */ | ||
var isArrayLike; | ||
if (typeof module === 'object' && module.exports) { | ||
require('es5-shim'); | ||
require('es5-shim/es5-sham'); | ||
if (typeof JSON === 'undefined') { | ||
JSON = {}; | ||
} | ||
require('json3').runInContext(null, JSON); | ||
require('es6-shim'); | ||
var es7 = require('es7-shim'); | ||
Object.keys(es7).forEach(function (key) { | ||
var obj = es7[key]; | ||
if (typeof obj.shim === 'function') { | ||
obj.shim(); | ||
} | ||
}); | ||
isArrayLike = require('../../index.js'); | ||
} else { | ||
isArrayLike = returnExports; | ||
} | ||
/* eslint strict: 1, max-lines: 1, symbol-description: 1, max-nested-callbacks: 1, | ||
max-statements: 1, no-sparse-arrays: 1, no-new-func: 1 */ | ||
describe('Basic tests', function () { | ||
it('should return `true` for array-like values', function () { | ||
(function () { | ||
var values = [ | ||
arguments, | ||
[ | ||
1, | ||
2, | ||
3 | ||
], | ||
{ 0: 1, length: 1 }, | ||
'a' | ||
]; | ||
var expected = values.map(function () { | ||
return true; | ||
}); | ||
var actual = values.map(isArrayLike); | ||
expect(actual).toEqual(expected); | ||
}(1, 2, 3)); | ||
}); | ||
/* global JSON:true, expect, module, require, describe, it, returnExports */ | ||
;(function () { // eslint-disable-line no-extra-semi | ||
'use strict'; | ||
var isArrayLike; | ||
if (typeof module === 'object' && module.exports) { | ||
require('es5-shim'); | ||
require('es5-shim/es5-sham'); | ||
if (typeof JSON === 'undefined') { | ||
JSON = {}; | ||
} | ||
require('json3').runInContext(null, JSON); | ||
require('es6-shim'); | ||
var es7 = require('es7-shim'); | ||
Object.keys(es7).forEach(function (key) { | ||
var obj = es7[key]; | ||
if (typeof obj.shim === 'function') { | ||
obj.shim(); | ||
it('should return `false` for non-arrays', function () { | ||
var falsey = [ | ||
'', | ||
0, | ||
false, | ||
NaN, | ||
null, | ||
undefined | ||
]; | ||
var generator = (function () { | ||
try { | ||
// eslint-disable-next-line no-new-func | ||
return new Function('return function*(){}'); | ||
} catch (ignore) { | ||
return void 0; | ||
} | ||
}()); | ||
var expected = falsey.map(function (value) { | ||
return value === ''; | ||
}); | ||
isArrayLike = require('../../index.js'); | ||
} else { | ||
isArrayLike = returnExports; | ||
} | ||
describe('Basic tests', function () { | ||
it('should return `true` for array-like values', function () { | ||
(function () { | ||
var values = [arguments, [1, 2, 3], { 0: 1, length: 1 }, 'a'], | ||
expected = values.map(function () { | ||
return true; | ||
}), | ||
actual = values.map(isArrayLike); | ||
expect(actual).toEqual(expected); | ||
}(1, 2, 3)); | ||
var actual = falsey.map(function (value) { | ||
return isArrayLike(value); | ||
}); | ||
expect(actual).toEqual(expected); | ||
expect(isArrayLike(true)).toBe(false); | ||
expect(isArrayLike(new Date())).toBe(false); | ||
expect(isArrayLike(new Error())).toBe(false); | ||
expect(isArrayLike({})).toBe(false); | ||
expect(isArrayLike(generator)).toBe(false); | ||
expect(isArrayLike(Array.prototype.slice)).toBe(false); | ||
expect(isArrayLike({ a: 1 })).toBe(false); | ||
expect(isArrayLike(1)).toBe(false); | ||
expect(isArrayLike(/x/)).toBe(false); | ||
it('should return `false` for non-arrays', function () { | ||
/* jshint elision:true */ | ||
var falsey = [, '', 0, false, NaN, null, undefined]; | ||
var generator = (function () { | ||
try { | ||
/* jshint evil:true */ | ||
return new Function('return function*(){}'); | ||
} catch (ignore) { | ||
return void 0; | ||
} | ||
}()); | ||
var expected = falsey.map(function (value) { | ||
return value === ''; | ||
}); | ||
var actual = falsey.map(function (value, index) { | ||
return index ? isArrayLike(value) : isArrayLike(); | ||
}); | ||
expect(actual).toEqual(expected); | ||
expect(isArrayLike(true)).toBe(false); | ||
expect(isArrayLike(new Date())).toBe(false); | ||
expect(isArrayLike(new Error())).toBe(false); | ||
expect(isArrayLike({})).toBe(false); | ||
expect(isArrayLike(generator)).toBe(false); | ||
expect(isArrayLike(Array.prototype.slice)).toBe(false); | ||
expect(isArrayLike({ a: 1 })).toBe(false); | ||
expect(isArrayLike(1)).toBe(false); | ||
expect(isArrayLike(/x/)).toBe(false); | ||
try { | ||
// eslint-disable-next-line no-new-func | ||
var fat = new Function('return () => {return this;}'); | ||
expect(isArrayLike(fat)).toBe(false); | ||
} catch (ignore) {} | ||
try { | ||
/* jshint evil:true */ | ||
var fat = new Function('return () => {return this;}'); | ||
expect(isArrayLike(fat)).toBe(false); | ||
} catch (ignore) {} | ||
try { | ||
// eslint-disable-next-line no-new-func | ||
var gen = new Function('return function* idMaker(){}'); | ||
expect(isArrayLike(gen)).toBe(false); | ||
} catch (ignore) {} | ||
try { | ||
/* jshint evil:true */ | ||
var gen = new Function('return function* idMaker(){}'); | ||
expect(isArrayLike(gen)).toBe(false); | ||
} catch (ignore) {} | ||
try { | ||
/* jshint evil:true */ | ||
var classes = new Function('"use strict"; return class MyClass {}'); | ||
expect(isArrayLike(classes)).toBe(false); | ||
} catch (ignore) {} | ||
}); | ||
try { | ||
// eslint-disable-next-line no-new-func | ||
var classes = new Function('"use strict"; return class MyClass {}'); | ||
expect(isArrayLike(classes)).toBe(false); | ||
} catch (ignore) {} | ||
}); | ||
}()); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
17
0
35968
27
558
Updatedis-function-x@^1.4.0
Updatedis-nil-x@^1.4.0