Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-array-x

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-array-x - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

dist/is-array-x.esm.js

284

dist/is-array-x.js
/*!
{
"author": "Graham Fairweather",
"copywrite": "Copyright (c) 2017-present",
"date": "2019-07-10T19:39:24.315Z",
"date": "2019-07-12T13:57:54.841Z",
"describe": "",
"description": "Determines whether the passed value is an Array.",
"file": "is-array-x.js",
"hash": "964cfa5b09fac87dbda2",
"hash": "3b34cce00c95b7a4b794",
"license": "MIT",
"version": "2.0.1"
"version": "2.0.2"
}

@@ -127,85 +128,9 @@ */

/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _attemptX = _interopRequireDefault(__webpack_require__(1));
var _toStringTagX = _interopRequireDefault(__webpack_require__(2));
var _this = void 0;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } }
var nativeIsArray = typeof Array.isArray === 'function' && Array.isArray;
var testRes = nativeIsArray && (0, _attemptX.default)(function () {
_newArrowCheck(this, _this);
return nativeIsArray([]) === true && nativeIsArray({
length: 0
}) === false;
}.bind(void 0));
var isArrayFn = function iife() {
if (testRes && testRes.threw === false && testRes.value === true) {
return nativeIsArray;
}
/**
* The isArray() function determines whether the passed value is an Array.
*
* @function isArray
* @param {*} [value] - The object to be checked..
* @returns {boolean} `true` if the object is an Array; otherwise, `false`.
*/
return function isArray(value) {
return (0, _toStringTagX.default)(value) === '[object Array]';
};
}();
var _default = isArrayFn;
exports.default = _default;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/attempt-x/dist/attempt-x.esm.js
/**
* @file Invokes function, returning an object of the results.
* @version 1.1.3
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module attempt-x
*/
var getArgs = function _getArgs(args) {
var length = args.length >>> 0;
var array = [];
var argLength = length - 1;
if (argLength < 1) {
return array;
}
array.length = argLength;
for (var index = 1; index < length; index += 1) {
array[index - 1] = args[index];
}
return array;
};
/**
* This method attempts to invoke the function, returning either the result or

@@ -215,45 +140,17 @@ * the caught error object. Any additional arguments are provided to the

*
* @param {Function} fn - The function to attempt.
* @param {Function} [fn] - The function to attempt.
* @param {...*} [args] - The arguments to invoke the function with.
* @returns {Object} Returns an object of the result.
* @example
* var attempt = require('attempt-x');
*
* function thrower() {
* throw new Error('Threw');
* }
*
* attempt(thrower, 1, 2);
* // {
* // threw: true,
* // value: // Error('Threw') object
* // }
*
* function sumArgs(a, b) {
* return a + b;
* }
*
* attempt(sumArgs, 1, 2);
* // {
* // threw: false,
* // value: 3
* // }
*
* var thisArg = [];
* function pusher(a, b) {
* return this.push(a, b);
* }
*
* attempt.call(thisArg, pusher, 1, 2);
* // {
* // threw: false,
* // value: 2
* // }
* // thisArg => [1, 2];
* @returns {object} Returns an object of the result.
*/
module.exports = function attempt(fn) {
function attempt(fn) {
try {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return {
threw: false,
value: fn.apply(this, getArgs(arguments))
/* eslint-disable-next-line babel/no-invalid-this */
value: fn.apply(this, args)
};

@@ -266,139 +163,68 @@ } catch (e) {

}
};
}
;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/to-string-tag-x/dist/to-string-tag-x.esm.js
var nativeObjectToString = {}.toString;
/**
* @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.3
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-tag-x
*/
var isNull = __webpack_require__(3);
var isUndefined = __webpack_require__(4);
var toStr = {}.toString;
/**
* The `toStringTag` method returns "[object type]", where type is the
* object type.
*
* @param {*} value - The object of which to get the object type string.
* @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)) {
function toStringTag(value) {
if (value === null) {
return '[object Null]';
}
if (isUndefined(value)) {
if (typeof value === 'undefined') {
return '[object Undefined]';
}
return toStr.call(value);
};
return nativeObjectToString.call(value);
}
/***/ }),
/* 3 */
/***/ (function(module, exports) {
// CONCATENATED MODULE: ./dist/is-array-x.esm.js
var _this = undefined;
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } }
/**
* Checks if `value` is `null`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
* @example
*
* _.isNull(null);
* // => true
*
* _.isNull(void 0);
* // => false
*/
function isNull(value) {
return value === null;
}
module.exports = isNull;
var nativeIsArray = [].isArray;
var isArrayNative = typeof nativeIsArray === 'function' && nativeIsArray;
var testRes = isArrayNative && attempt(function () {
_newArrowCheck(this, _this);
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
return isArrayNative([]) === true && isArrayNative({
length: 0
}) === false;
}.bind(undefined));
"use strict";
/**
*
* VALIDATE: undefined
*
*
* DESCRIPTION:
* - Validates if a value is undefined.
*
*
* NOTES:
* [1]
*
*
* TODO:
* [1]
*
*
* LICENSE:
* MIT
*
* Copyright (c) 2014. Athan Reines.
*
*
* AUTHOR:
* Athan Reines. kgryte@gmail.com. 2014.
*
*/
var isArrayFn = function iife() {
if (testRes && testRes.threw === false && testRes.value === true) {
return isArrayNative;
}
/**
* The isArray() function determines whether the passed value is an Array.
*
* @function isArray
* @param {*} [value] - The object to be checked..
* @returns {boolean} `true` if the object is an Array; otherwise, `false`.
*/
return function isArray(value) {
return toStringTag(value) === '[object Array]';
};
}();
/**
* FUNCTION: isUndefined( value )
* Validates if a value is undefined.
*
* @param {*} value - value to be validated
* @returns {Boolean} boolean indicating whether value is undefined
*/
function isUndefined( value ) {
return value === void 0;
} // end FUNCTION isUndefined()
/* harmony default export */ var is_array_x_esm = __webpack_exports__["default"] = (isArrayFn);
// EXPORTS //
module.exports = isUndefined;
/***/ })

@@ -405,0 +231,0 @@ /******/ ]);

/*!
{
"author": "Graham Fairweather",
"copywrite": "Copyright (c) 2017-present",
"date": "2019-07-10T19:39:24.315Z",
"date": "2019-07-12T13:57:54.841Z",
"describe": "",
"description": "Determines whether the passed value is an Array.",
"file": "is-array-x.min.js",
"hash": "a93f06ab317ecb656318",
"hash": "37f1838b3bfac520c0fd",
"license": "MIT",
"version": "2.0.1"
"version": "2.0.2"
}
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.isArrayX=t():e.isArrayX=t()}(function(){"use strict";return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()}(),function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(1)),o=u(n(2));function u(e){return e&&e.__esModule?e:{default:e}}var i="function"==typeof Array.isArray&&Array.isArray,f=i&&(0,r.default)(function(){return function(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),!0===i([])&&!1===i({length:0})}.bind(void 0)),c=f&&!1===f.threw&&!0===f.value?i:function(e){return"[object Array]"===(0,o.default)(e)};t.default=c},function(e,t,n){"use strict";
/**
* @file Invokes function, returning an object of the results.
* @version 1.1.3
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module attempt-x
*/var r=function(e){var t=e.length>>>0,n=[],r=t-1;if(r<1)return n;n.length=r;for(var o=1;o<t;o+=1)n[o-1]=e[o];return n};e.exports=function(e){try{return{threw:!1,value:e.apply(this,r(arguments))}}catch(e){return{threw:!0,value:e}}}},function(e,t,n){"use strict";
/**
* @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.3
* @author Xotic750 <Xotic750@gmail.com>
* @copyright Xotic750
* @license {@link <https://opensource.org/licenses/MIT> MIT}
* @module to-string-tag-x
*/var r=n(3),o=n(4),u={}.toString;e.exports=function(e){return r(e)?"[object Null]":o(e)?"[object Undefined]":u.call(e)}},function(e,t){e.exports=function(e){return null===e}},function(e,t,n){"use strict";e.exports=function(e){return void 0===e}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.isArrayX=t():e.isArrayX=t()}(function(){"use strict";return"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()}(),function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r={}.toString;var o=[].isArray,u="function"==typeof o&&o,i=u&&function(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return{threw:!1,value:e.apply(this,n)}}catch(e){return{threw:!0,value:e}}}(function(){return function(e,t){if(e!==t)throw new TypeError("Cannot instantiate an arrow function")}(this,void 0),!0===u([])&&!1===u({length:0})}.bind(void 0)),f=i&&!1===i.threw&&!0===i.value?u:function(e){return"[object Array]"===function(e){return null===e?"[object Null]":void 0===e?"[object Undefined]":r.call(e)}(e)};t.default=f}])});
//# sourceMappingURL=is-array-x.min.js.map
{
"name": "is-array-x",
"version": "2.0.1",
"version": "2.0.2",
"description": "Determines whether the passed value is an Array.",

@@ -23,8 +23,8 @@ "homepage": "https://github.com/Xotic750/is-array-x",

],
"browser": "dist/is-array-x.min.js",
"module": "src/is-array-x.js",
"module": "dist/is-array-x.esm.js",
"main": "dist/is-array-x.js",
"scripts": {
"build:esm": "mkdirp dist && babel -s true --env-name esm src/is-array-x.js -o dist/is-array-x.esm.js",
"build:base": "webpack --bail --progress --profile --colors",
"build": "cross-env NODE_ENV=production npm run build:base --",
"build": "npm run build:esm && cross-env NODE_ENV=production npm run build:base --",
"build:dev": "npm run build:base --",

@@ -53,4 +53,4 @@ "clean": "rimraf dist && npm run clean:coverage",

"dependencies": {
"attempt-x": "^1.1.3",
"to-string-tag-x": "^1.4.3"
"attempt-x": "^2.0.1",
"to-string-tag-x": "^2.0.5"
},

@@ -60,2 +60,7 @@ "devDependencies": {

"@babel/core": "^7.5.4",
"@babel/node": "^7.5.0",
"@babel/plugin-proposal-class-properties": "^7.5.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-export-default-from": "^7.2.0",
"@babel/plugin-syntax-export-namespace-from": "^7.2.0",
"@babel/plugin-transform-property-mutators": "^7.2.0",

@@ -65,10 +70,12 @@ "@babel/plugin-transform-runtime": "^7.5.0",

"@babel/runtime": "^7.5.4",
"@prorenata/eslint-config-vue": "^1.13.5",
"@prorenata/eslint-config-vue": "^1.13.6",
"@types/jest": "^24.0.15",
"@types/node": "^12.6.1",
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
"@types/node": "^12.6.2",
"babel-core": "^7.0.0-0",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babel-plugin-lodash": "^3.3.4",
"caniuse-lite": "^1.0.30000983",
"chalk": "^2.4.2",
"concurrently": "^4.1.1",
"cross-env": "^5.2.0",

@@ -88,3 +95,3 @@ "eslint": "=5.16.0",

"eslint-plugin-jest": "^22.7.2",
"eslint-plugin-jsdoc": "^15.3.2",
"eslint-plugin-jsdoc": "^15.3.5",
"eslint-plugin-json": "^1.4.0",

@@ -100,10 +107,16 @@ "eslint-plugin-lodash": "^5.1.0",

"friendly-errors-webpack-plugin": "^1.7.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.8.0",
"jest-cli": "^24.8.0",
"jest-css": "^1.0.1",
"jest-file": "^1.0.0",
"lodash": "^4.17.13",
"jsdoc-to-markdown": "^5.0.0",
"lodash": "^4.17.14",
"lodash-webpack-plugin": "^0.11.5",
"mkdirp": "^0.5.1",
"node-notifier": "^5.4.0",
"nodemon": "^1.19.1",
"prettier": "=1.14.3",
"rimraf": "^2.6.3",
"semver": "^6.2.0",
"source-map-loader": "^0.2.4",
"terser-webpack-plugin": "^1.3.0",

@@ -110,0 +123,0 @@ "typescript": "^3.5.3",

import attempt from 'attempt-x';
import toStringTag from 'to-string-tag-x';
const nativeIsArray = typeof Array.isArray === 'function' && Array.isArray;
const nativeIsArray = [].isArray;
const isArrayNative = typeof nativeIsArray === 'function' && nativeIsArray;
const testRes =
nativeIsArray &&
isArrayNative &&
attempt(() => {
return nativeIsArray([]) === true && nativeIsArray({length: 0}) === false;
return isArrayNative([]) === true && isArrayNative({length: 0}) === false;
});

@@ -14,3 +15,3 @@

if (testRes && testRes.threw === false && testRes.value === true) {
return nativeIsArray;
return isArrayNative;
}

@@ -17,0 +18,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc