object-keys-x
Advanced tools
Comparing version 1.1.0 to 1.2.0
59
index.js
/** | ||
* @file An ES6 Object.keys shim. | ||
* @version 1.1.0 | ||
* @version 1.2.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -13,41 +13,34 @@ * @copyright Xotic750 | ||
var originalKeys = Object.keys; | ||
var objectKeys; | ||
var keysWorksWithArguments; | ||
var keysHasArgumentsLengthBug; | ||
var worksWithPrimitives; | ||
var keysWorksWithArguments = false; | ||
var keysHasArgumentsLengthBug = true; | ||
var worksWithPrimitives = false; | ||
var toObject; | ||
if (originalKeys) { | ||
try { | ||
keysWorksWithArguments = (function () { | ||
// Safari 5.0 bug | ||
return originalKeys(arguments).length === 2; | ||
}(1, 2)); | ||
if (Boolean(originalKeys) === false) { | ||
originalKeys = require('object-keys'); | ||
} | ||
keysHasArgumentsLengthBug = (function () { | ||
var argKeys = originalKeys(arguments); | ||
return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; | ||
}(1)); | ||
try { | ||
keysWorksWithArguments = (function () { | ||
// Safari 5.0 bug | ||
return originalKeys(arguments).length === 2; | ||
}(1, 2)); | ||
worksWithPrimitives = (function () { | ||
return originalKeys(1).length === 0; | ||
}(1)); | ||
keysHasArgumentsLengthBug = (function () { | ||
var argKeys = originalKeys(arguments); | ||
return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; | ||
}(1)); | ||
if (keysWorksWithArguments === false || keysHasArgumentsLengthBug || worksWithPrimitives === false) { | ||
var slice = require('array-slice-x'); | ||
var isArguments = require('is-arguments'); | ||
toObject = require('to-object-x'); | ||
objectKeys = function keys(object) { | ||
return originalKeys(isArguments(object) ? slice(object) : toObject(object)); | ||
}; | ||
} | ||
} catch (e) {} | ||
} | ||
worksWithPrimitives = (function () { | ||
return originalKeys(1).length === 0; | ||
}(1)); | ||
} catch (e) {} | ||
objectKeys = objectKeys || originalKeys; | ||
if (!objectKeys) { | ||
var shim = require('object-keys'); | ||
var objectKeys; | ||
if (keysWorksWithArguments === false || keysHasArgumentsLengthBug || worksWithPrimitives === false) { | ||
var slice = require('array-slice-x'); | ||
var isArguments = require('is-arguments'); | ||
toObject = require('to-object-x'); | ||
objectKeys = function keys(object) { | ||
return shim(toObject(object)); | ||
return originalKeys(isArguments(object) ? slice(object) : toObject(object)); | ||
}; | ||
@@ -78,2 +71,2 @@ } | ||
*/ | ||
module.exports = objectKeys; | ||
module.exports = objectKeys || originalKeys; |
(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 An ES6 Object.keys shim. | ||
* @version 1.1.0 | ||
* @version 1.2.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -14,41 +14,34 @@ * @copyright Xotic750 | ||
var originalKeys = Object.keys; | ||
var objectKeys; | ||
var keysWorksWithArguments; | ||
var keysHasArgumentsLengthBug; | ||
var worksWithPrimitives; | ||
var keysWorksWithArguments = false; | ||
var keysHasArgumentsLengthBug = true; | ||
var worksWithPrimitives = false; | ||
var toObject; | ||
if (originalKeys) { | ||
try { | ||
keysWorksWithArguments = (function () { | ||
// Safari 5.0 bug | ||
return originalKeys(arguments).length === 2; | ||
}(1, 2)); | ||
if (Boolean(originalKeys) === false) { | ||
originalKeys = _dereq_('object-keys'); | ||
} | ||
keysHasArgumentsLengthBug = (function () { | ||
var argKeys = originalKeys(arguments); | ||
return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; | ||
}(1)); | ||
try { | ||
keysWorksWithArguments = (function () { | ||
// Safari 5.0 bug | ||
return originalKeys(arguments).length === 2; | ||
}(1, 2)); | ||
worksWithPrimitives = (function () { | ||
return originalKeys(1).length === 0; | ||
}(1)); | ||
keysHasArgumentsLengthBug = (function () { | ||
var argKeys = originalKeys(arguments); | ||
return arguments.length !== 1 || argKeys.length !== 1 || argKeys[0] !== 1; | ||
}(1)); | ||
if (keysWorksWithArguments === false || keysHasArgumentsLengthBug || worksWithPrimitives === false) { | ||
var slice = _dereq_('array-slice-x'); | ||
var isArguments = _dereq_('is-arguments'); | ||
toObject = _dereq_('to-object-x'); | ||
objectKeys = function keys(object) { | ||
return originalKeys(isArguments(object) ? slice(object) : toObject(object)); | ||
}; | ||
} | ||
} catch (e) {} | ||
} | ||
worksWithPrimitives = (function () { | ||
return originalKeys(1).length === 0; | ||
}(1)); | ||
} catch (e) {} | ||
objectKeys = objectKeys || originalKeys; | ||
if (!objectKeys) { | ||
var shim = _dereq_('object-keys'); | ||
var objectKeys; | ||
if (keysWorksWithArguments === false || keysHasArgumentsLengthBug || worksWithPrimitives === false) { | ||
var slice = _dereq_('array-slice-x'); | ||
var isArguments = _dereq_('is-arguments'); | ||
toObject = _dereq_('to-object-x'); | ||
objectKeys = function keys(object) { | ||
return shim(toObject(object)); | ||
return originalKeys(isArguments(object) ? slice(object) : toObject(object)); | ||
}; | ||
@@ -79,8 +72,8 @@ } | ||
*/ | ||
module.exports = objectKeys; | ||
module.exports = objectKeys || originalKeys; | ||
},{"array-slice-x":2,"is-arguments":5,"object-keys":15,"to-object-x":20}],2:[function(_dereq_,module,exports){ | ||
},{"array-slice-x":2,"is-arguments":6,"object-keys":17,"to-object-x":22}],2:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Cross-browser array slicer. | ||
* @version 1.1.0 | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -98,2 +91,4 @@ * @copyright Xotic750 | ||
var isUndefined = _dereq_('validate.io-undefined'); | ||
var isString = _dereq_('is-string'); | ||
var splitString = _dereq_('has-boxed-string-x') === false; | ||
@@ -104,5 +99,6 @@ var setRelative = function _seedRelative(value, length) { | ||
var slice = function _slice(array, start, end) { | ||
var $slice = function slice(array, start, end) { | ||
var object = toObject(array); | ||
var length = toLength(object.length); | ||
var iterable = splitString && isString(object) ? object.split('') : object; | ||
var length = toLength(iterable.length); | ||
var k = setRelative(toInteger(start), length); | ||
@@ -115,4 +111,4 @@ var relativeEnd = isUndefined(end) ? length : toInteger(end); | ||
while (k < finalEnd) { | ||
if (k in object) { | ||
val[next] = object[k]; | ||
if (k in iterable) { | ||
val[next] = iterable[k]; | ||
} | ||
@@ -132,8 +128,8 @@ | ||
* | ||
* @param {Array|Object} array The array to slice. | ||
* @param {number} [start] Zero-based index at which to begin extraction. | ||
* @param {Array|Object} array - The array to slice. | ||
* @param {number} [start] - Zero-based index at which to begin extraction. | ||
* A negative index can be used, indicating an offset from the end of the | ||
* sequence. slice(-2) extracts the last two elements in the sequence. | ||
* If begin is undefined, slice begins from index 0. | ||
* @param {number} [end] Zero-based index before which to end extraction. | ||
* @param {number} [end] - Zero-based index before which to end extraction. | ||
* Slice extracts up to but not including end. For example, slice(1,4) | ||
@@ -149,3 +145,3 @@ * extracts the second element through the fourth element (elements indexed | ||
* the end of the sequence (arr.length). | ||
* @return {Array} A new array containing the extracted elements. | ||
* @returns {Array} A new array containing the extracted elements. | ||
* @example | ||
@@ -159,5 +155,5 @@ * var slice = require('array-slice-x'); | ||
*/ | ||
module.exports = slice; | ||
module.exports = $slice; | ||
},{"to-integer-x":18,"to-length-x":19,"to-object-x":20,"validate.io-undefined":21}],3:[function(_dereq_,module,exports){ | ||
},{"has-boxed-string-x":5,"is-string":13,"to-integer-x":20,"to-length-x":21,"to-object-x":22,"validate.io-undefined":23}],3:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -220,3 +216,3 @@ | ||
},{"foreach":4,"object-keys":15}],4:[function(_dereq_,module,exports){ | ||
},{"foreach":4,"object-keys":17}],4:[function(_dereq_,module,exports){ | ||
@@ -246,4 +242,28 @@ var hasOwn = Object.prototype.hasOwnProperty; | ||
},{}],5:[function(_dereq_,module,exports){ | ||
/** | ||
* @file Check support of by-index access of string characters. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module has-boxed-string-x | ||
*/ | ||
'use strict'; | ||
var boxedString = Object('a'); | ||
/** | ||
* Check failure of by-index access of string characters (IE < 9) | ||
* and failure of `0 in boxedString` (Rhino). | ||
* | ||
* `true` if no failure; otherwise `false`. | ||
* | ||
* @type boolean | ||
*/ | ||
module.exports = boxedString[0] === 'a' && (0 in boxedString); | ||
},{}],6:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
var toStr = Object.prototype.toString; | ||
@@ -275,3 +295,3 @@ | ||
},{}],6:[function(_dereq_,module,exports){ | ||
},{}],7:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -324,3 +344,3 @@ * @file ES6-compliant shim for Number.isFinite. | ||
},{"is-nan":8,"max-safe-integer":14}],7:[function(_dereq_,module,exports){ | ||
},{"is-nan":9,"max-safe-integer":16}],8:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -334,3 +354,3 @@ | ||
},{}],8:[function(_dereq_,module,exports){ | ||
},{}],9:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -354,3 +374,3 @@ | ||
},{"./implementation":7,"./polyfill":9,"./shim":10,"define-properties":3}],9:[function(_dereq_,module,exports){ | ||
},{"./implementation":8,"./polyfill":10,"./shim":11,"define-properties":3}],10:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -367,3 +387,3 @@ | ||
},{"./implementation":7}],10:[function(_dereq_,module,exports){ | ||
},{"./implementation":8}],11:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -382,3 +402,3 @@ | ||
},{"./polyfill":9,"define-properties":3}],11:[function(_dereq_,module,exports){ | ||
},{"./polyfill":10,"define-properties":3}],12:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -414,3 +434,25 @@ * @file Checks if `value` is `null` or `undefined`. | ||
},{"lodash.isnull":12,"validate.io-undefined":21}],12:[function(_dereq_,module,exports){ | ||
},{"lodash.isnull":14,"validate.io-undefined":23}],13:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
var strValue = String.prototype.valueOf; | ||
var tryStringObject = function tryStringObject(value) { | ||
try { | ||
strValue.call(value); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}; | ||
var toStr = Object.prototype.toString; | ||
var strClass = '[object String]'; | ||
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; | ||
module.exports = function isString(value) { | ||
if (typeof value === 'string') { return true; } | ||
if (typeof value !== 'object') { return false; } | ||
return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; | ||
}; | ||
},{}],14:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -447,3 +489,3 @@ * lodash 3.0.0 (Custom Build) <https://lodash.com/> | ||
},{}],13:[function(_dereq_,module,exports){ | ||
},{}],15:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -501,7 +543,7 @@ * @file ES6-compliant shim for Math.sign. | ||
},{"is-nan":8}],14:[function(_dereq_,module,exports){ | ||
},{"is-nan":9}],16:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
module.exports = 9007199254740991; | ||
},{}],15:[function(_dereq_,module,exports){ | ||
},{}],17:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -648,3 +690,3 @@ | ||
},{"./isArguments":16}],16:[function(_dereq_,module,exports){ | ||
},{"./isArguments":18}],18:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -668,3 +710,3 @@ | ||
},{}],17:[function(_dereq_,module,exports){ | ||
},{}],19:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -708,3 +750,3 @@ * @file ES6-compliant shim for RequireObjectCoercible. | ||
},{"is-nil-x":11}],18:[function(_dereq_,module,exports){ | ||
},{"is-nil-x":12}],20:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -752,3 +794,3 @@ * @file ToInteger converts 'argument' to an integral numeric value. | ||
},{"is-finite-x":6,"is-nan":8,"math-sign-x":13}],19:[function(_dereq_,module,exports){ | ||
},{"is-finite-x":7,"is-nan":9,"math-sign-x":15}],21:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -796,3 +838,3 @@ * @file ES6-compliant shim for ToLength. | ||
},{"max-safe-integer":14,"to-integer-x":18}],20:[function(_dereq_,module,exports){ | ||
},{"max-safe-integer":16,"to-integer-x":20}],22:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -832,3 +874,3 @@ * @file ES6-compliant shim for ToObject. | ||
},{"require-object-coercible-x":17}],21:[function(_dereq_,module,exports){ | ||
},{"require-object-coercible-x":19}],23:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -835,0 +877,0 @@ * |
!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 An ES6 Object.keys shim. | ||
* @version 1.1.0 | ||
* @version 1.2.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -9,5 +9,5 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var objectKeys,keysWorksWithArguments,keysHasArgumentsLengthBug,worksWithPrimitives,toObject,originalKeys=Object.keys;if(originalKeys)try{if(keysWorksWithArguments=function(){return 2===originalKeys(arguments).length}(1,2),keysHasArgumentsLengthBug=function(){var argKeys=originalKeys(arguments);return 1!==arguments.length||1!==argKeys.length||1!==argKeys[0]}(1),worksWithPrimitives=0===originalKeys(1).length,!1===keysWorksWithArguments||keysHasArgumentsLengthBug||!1===worksWithPrimitives){var slice=_dereq_("array-slice-x"),isArguments=_dereq_("is-arguments");toObject=_dereq_("to-object-x"),objectKeys=function keys(object){return originalKeys(isArguments(object)?slice(object):toObject(object))}}}catch(e){}if(!(objectKeys=objectKeys||originalKeys)){var shim=_dereq_("object-keys");toObject=_dereq_("to-object-x"),objectKeys=function keys(object){return shim(toObject(object))}}module.exports=objectKeys},{"array-slice-x":2,"is-arguments":5,"object-keys":15,"to-object-x":20}],2:[function(_dereq_,module,exports){/** | ||
"use strict";var toObject,originalKeys=Object.keys,keysWorksWithArguments=!1,keysHasArgumentsLengthBug=!0,worksWithPrimitives=!1;!1===Boolean(originalKeys)&&(originalKeys=_dereq_("object-keys"));try{keysWorksWithArguments=function(){return 2===originalKeys(arguments).length}(1,2),keysHasArgumentsLengthBug=function(){var argKeys=originalKeys(arguments);return 1!==arguments.length||1!==argKeys.length||1!==argKeys[0]}(1),worksWithPrimitives=0===originalKeys(1).length}catch(e){}var objectKeys;if(!1===keysWorksWithArguments||keysHasArgumentsLengthBug||!1===worksWithPrimitives){var slice=_dereq_("array-slice-x"),isArguments=_dereq_("is-arguments");toObject=_dereq_("to-object-x"),objectKeys=function keys(object){return originalKeys(isArguments(object)?slice(object):toObject(object))}}module.exports=objectKeys||originalKeys},{"array-slice-x":2,"is-arguments":6,"object-keys":17,"to-object-x":22}],2:[function(_dereq_,module,exports){/** | ||
* @file Cross-browser array slicer. | ||
* @version 1.1.0 | ||
* @version 2.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -18,3 +18,11 @@ * @copyright Xotic750 | ||
*/ | ||
"use strict";var toObject=_dereq_("to-object-x"),toInteger=_dereq_("to-integer-x"),toLength=_dereq_("to-length-x"),isUndefined=_dereq_("validate.io-undefined"),setRelative=function _seedRelative(value,length){return value<0?Math.max(length+value,0):Math.min(value,length)};module.exports=function _slice(array,start,end){var object=toObject(array),length=toLength(object.length),k=setRelative(toInteger(start),length),relativeEnd=isUndefined(end)?length:toInteger(end),finalEnd=setRelative(relativeEnd,length),val=[];val.length=Math.max(finalEnd-k,0);for(var next=0;k<finalEnd;)k in object&&(val[next]=object[k]),next+=1,k+=1;return val}},{"to-integer-x":18,"to-length-x":19,"to-object-x":20,"validate.io-undefined":21}],3:[function(_dereq_,module,exports){"use strict";var keys=_dereq_("object-keys"),foreach=_dereq_("foreach"),hasSymbols="function"==typeof Symbol&&"symbol"==typeof Symbol(),toStr=Object.prototype.toString,isFunction=function(fn){return"function"==typeof fn&&"[object Function]"===toStr.call(fn)},supportsDescriptors=Object.defineProperty&&function(){var obj={};try{Object.defineProperty(obj,"x",{enumerable:!1,value:obj});for(var _ in obj)return!1;return obj.x===obj}catch(e){return!1}}(),defineProperty=function(object,name,value,predicate){(!(name in object)||isFunction(predicate)&&predicate())&&(supportsDescriptors?Object.defineProperty(object,name,{configurable:!0,enumerable:!1,value:value,writable:!0}):object[name]=value)},defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{},props=keys(map);hasSymbols&&(props=props.concat(Object.getOwnPropertySymbols(map))),foreach(props,function(name){defineProperty(object,name,map[name],predicates[name])})};defineProperties.supportsDescriptors=!!supportsDescriptors,module.exports=defineProperties},{foreach:4,"object-keys":15}],4:[function(_dereq_,module,exports){var hasOwn=Object.prototype.hasOwnProperty,toString=Object.prototype.toString;module.exports=function forEach(obj,fn,ctx){if("[object Function]"!==toString.call(fn))throw new TypeError("iterator must be a function");var l=obj.length;if(l===+l)for(var i=0;i<l;i++)fn.call(ctx,obj[i],i,obj);else for(var k in obj)hasOwn.call(obj,k)&&fn.call(ctx,obj[k],k,obj)}},{}],5:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString,isStandardArguments=function isArguments(value){return"[object Arguments]"===toStr.call(value)},isLegacyArguments=function isArguments(value){return!!isStandardArguments(value)||null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&"[object Array]"!==toStr.call(value)&&"[object Function]"===toStr.call(value.callee)},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments,module.exports=supportsStandardArguments?isStandardArguments:isLegacyArguments},{}],6:[function(_dereq_,module,exports){/** | ||
"use strict";var toObject=_dereq_("to-object-x"),toInteger=_dereq_("to-integer-x"),toLength=_dereq_("to-length-x"),isUndefined=_dereq_("validate.io-undefined"),isString=_dereq_("is-string"),splitString=!1===_dereq_("has-boxed-string-x"),setRelative=function _seedRelative(value,length){return value<0?Math.max(length+value,0):Math.min(value,length)};module.exports=function slice(array,start,end){var object=toObject(array),iterable=splitString&&isString(object)?object.split(""):object,length=toLength(iterable.length),k=setRelative(toInteger(start),length),relativeEnd=isUndefined(end)?length:toInteger(end),finalEnd=setRelative(relativeEnd,length),val=[];val.length=Math.max(finalEnd-k,0);for(var next=0;k<finalEnd;)k in iterable&&(val[next]=iterable[k]),next+=1,k+=1;return val}},{"has-boxed-string-x":5,"is-string":13,"to-integer-x":20,"to-length-x":21,"to-object-x":22,"validate.io-undefined":23}],3:[function(_dereq_,module,exports){"use strict";var keys=_dereq_("object-keys"),foreach=_dereq_("foreach"),hasSymbols="function"==typeof Symbol&&"symbol"==typeof Symbol(),toStr=Object.prototype.toString,isFunction=function(fn){return"function"==typeof fn&&"[object Function]"===toStr.call(fn)},supportsDescriptors=Object.defineProperty&&function(){var obj={};try{Object.defineProperty(obj,"x",{enumerable:!1,value:obj});for(var _ in obj)return!1;return obj.x===obj}catch(e){return!1}}(),defineProperty=function(object,name,value,predicate){(!(name in object)||isFunction(predicate)&&predicate())&&(supportsDescriptors?Object.defineProperty(object,name,{configurable:!0,enumerable:!1,value:value,writable:!0}):object[name]=value)},defineProperties=function(object,map){var predicates=arguments.length>2?arguments[2]:{},props=keys(map);hasSymbols&&(props=props.concat(Object.getOwnPropertySymbols(map))),foreach(props,function(name){defineProperty(object,name,map[name],predicates[name])})};defineProperties.supportsDescriptors=!!supportsDescriptors,module.exports=defineProperties},{foreach:4,"object-keys":17}],4:[function(_dereq_,module,exports){var hasOwn=Object.prototype.hasOwnProperty,toString=Object.prototype.toString;module.exports=function forEach(obj,fn,ctx){if("[object Function]"!==toString.call(fn))throw new TypeError("iterator must be a function");var l=obj.length;if(l===+l)for(var i=0;i<l;i++)fn.call(ctx,obj[i],i,obj);else for(var k in obj)hasOwn.call(obj,k)&&fn.call(ctx,obj[k],k,obj)}},{}],5:[function(_dereq_,module,exports){/** | ||
* @file Check support of by-index access of string characters. | ||
* @version 1.0.0 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
* @copyright Xotic750 | ||
* @license {@link <https://opensource.org/licenses/MIT> MIT} | ||
* @module has-boxed-string-x | ||
*/ | ||
"use strict";var boxedString=Object("a");module.exports="a"===boxedString[0]&&0 in boxedString},{}],6:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString,isStandardArguments=function isArguments(value){return"[object Arguments]"===toStr.call(value)},isLegacyArguments=function isArguments(value){return!!isStandardArguments(value)||null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&"[object Array]"!==toStr.call(value)&&"[object Function]"===toStr.call(value.callee)},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments,module.exports=supportsStandardArguments?isStandardArguments:isLegacyArguments},{}],7:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for Number.isFinite. | ||
@@ -28,3 +36,3 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-number.isfinite|20.1.2.2 Number.isFinite ( number )} | ||
*/ | ||
"use strict";var $isFinite,$isNaN=_dereq_("is-nan");if("function"==typeof Number.isFinite){var MAX_SAFE_INTEGER=_dereq_("max-safe-integer");try{Number.isFinite(MAX_SAFE_INTEGER)&&!1===Number.isFinite(Infinity)&&($isFinite=Number.isFinite)}catch(ignore){}}module.exports=$isFinite||function isFinite(number){return!("number"!=typeof number||$isNaN(number)||number===Infinity||number===-Infinity)}},{"is-nan":8,"max-safe-integer":14}],7:[function(_dereq_,module,exports){"use strict";module.exports=function isNaN(value){return value!==value}},{}],8:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),implementation=_dereq_("./implementation");define(implementation,{getPolyfill:_dereq_("./polyfill"),implementation:implementation,shim:_dereq_("./shim")}),module.exports=implementation},{"./implementation":7,"./polyfill":9,"./shim":10,"define-properties":3}],9:[function(_dereq_,module,exports){"use strict";var implementation=_dereq_("./implementation");module.exports=function getPolyfill(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:implementation}},{"./implementation":7}],10:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),getPolyfill=_dereq_("./polyfill");module.exports=function shimNumberIsNaN(){var polyfill=getPolyfill();return define(Number,{isNaN:polyfill},{isNaN:function(){return Number.isNaN!==polyfill}}),polyfill}},{"./polyfill":9,"define-properties":3}],11:[function(_dereq_,module,exports){/** | ||
"use strict";var $isFinite,$isNaN=_dereq_("is-nan");if("function"==typeof Number.isFinite){var MAX_SAFE_INTEGER=_dereq_("max-safe-integer");try{Number.isFinite(MAX_SAFE_INTEGER)&&!1===Number.isFinite(Infinity)&&($isFinite=Number.isFinite)}catch(ignore){}}module.exports=$isFinite||function isFinite(number){return!("number"!=typeof number||$isNaN(number)||number===Infinity||number===-Infinity)}},{"is-nan":9,"max-safe-integer":16}],8:[function(_dereq_,module,exports){"use strict";module.exports=function isNaN(value){return value!==value}},{}],9:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),implementation=_dereq_("./implementation");define(implementation,{getPolyfill:_dereq_("./polyfill"),implementation:implementation,shim:_dereq_("./shim")}),module.exports=implementation},{"./implementation":8,"./polyfill":10,"./shim":11,"define-properties":3}],10:[function(_dereq_,module,exports){"use strict";var implementation=_dereq_("./implementation");module.exports=function getPolyfill(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:implementation}},{"./implementation":8}],11:[function(_dereq_,module,exports){"use strict";var define=_dereq_("define-properties"),getPolyfill=_dereq_("./polyfill");module.exports=function shimNumberIsNaN(){var polyfill=getPolyfill();return define(Number,{isNaN:polyfill},{isNaN:function(){return Number.isNaN!==polyfill}}),polyfill}},{"./polyfill":10,"define-properties":3}],12:[function(_dereq_,module,exports){/** | ||
* @file Checks if `value` is `null` or `undefined`. | ||
@@ -37,3 +45,3 @@ * @version 1.4.0 | ||
*/ | ||
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":12,"validate.io-undefined":21}],12:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],13:[function(_dereq_,module,exports){/** | ||
"use strict";var isUndefined=_dereq_("validate.io-undefined"),isNull=_dereq_("lodash.isnull");module.exports=function isNil(value){return isNull(value)||isUndefined(value)}},{"lodash.isnull":14,"validate.io-undefined":23}],13:[function(_dereq_,module,exports){"use strict";var strValue=String.prototype.valueOf,tryStringObject=function tryStringObject(value){try{return strValue.call(value),!0}catch(e){return!1}},toStr=Object.prototype.toString,hasToStringTag="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;module.exports=function isString(value){return"string"==typeof value||"object"==typeof value&&(hasToStringTag?tryStringObject(value):"[object String]"===toStr.call(value))}},{}],14:[function(_dereq_,module,exports){module.exports=function isNull(value){return null===value}},{}],15:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for Math.sign. | ||
@@ -47,3 +55,3 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-math.sign|20.2.2.29 Math.sign(x)} | ||
*/ | ||
"use strict";var $sign,$isNaN=_dereq_("is-nan");if("function"==typeof Math.sign)try{1===Math.sign(10)&&-1===Math.sign(-10)&&0===Math.sign(0)&&($sign=Math.sign)}catch(ignore){}module.exports=$sign||function sign(x){var n=Number(x);return 0===n||$isNaN(n)?n:n>0?1:-1}},{"is-nan":8}],14:[function(_dereq_,module,exports){"use strict";module.exports=9007199254740991},{}],15:[function(_dereq_,module,exports){"use strict";var has=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,slice=Array.prototype.slice,isArgs=_dereq_("./isArguments"),isEnumerable=Object.prototype.propertyIsEnumerable,hasDontEnumBug=!isEnumerable.call({toString:null},"toString"),hasProtoEnumBug=isEnumerable.call(function(){},"prototype"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},excludedKeys={$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var k in window)try{if(!excludedKeys["$"+k]&&has.call(window,k)&&null!==window[k]&&"object"==typeof window[k])try{equalsConstructorPrototype(window[k])}catch(e){return!0}}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(o){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(o);try{return equalsConstructorPrototype(o)}catch(e){return!1}},keysShim=function keys(object){var isObject=null!==object&&"object"==typeof object,isFunction="[object Function]"===toStr.call(object),isArguments=isArgs(object),isString=isObject&&"[object String]"===toStr.call(object),theKeys=[];if(!isObject&&!isFunction&&!isArguments)throw new TypeError("Object.keys called on a non-object");var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0))for(var i=0;i<object.length;++i)theKeys.push(String(i));if(isArguments&&object.length>0)for(var j=0;j<object.length;++j)theKeys.push(String(j));else for(var name in object)skipProto&&"prototype"===name||!has.call(object,name)||theKeys.push(String(name));if(hasDontEnumBug)for(var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object),k=0;k<dontEnums.length;++k)skipConstructor&&"constructor"===dontEnums[k]||!has.call(object,dontEnums[k])||theKeys.push(dontEnums[k]);return theKeys};keysShim.shim=function shimObjectKeys(){if(Object.keys){if(!function(){return 2===(Object.keys(arguments)||"").length}(1,2)){var originalKeys=Object.keys;Object.keys=function keys(object){return originalKeys(isArgs(object)?slice.call(object):object)}}}else Object.keys=keysShim;return Object.keys||keysShim},module.exports=keysShim},{"./isArguments":16}],16:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;module.exports=function isArguments(value){var str=toStr.call(value),isArgs="[object Arguments]"===str;return isArgs||(isArgs="[object Array]"!==str&&null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&"[object Function]"===toStr.call(value.callee)),isArgs}},{}],17:[function(_dereq_,module,exports){/** | ||
"use strict";var $sign,$isNaN=_dereq_("is-nan");if("function"==typeof Math.sign)try{1===Math.sign(10)&&-1===Math.sign(-10)&&0===Math.sign(0)&&($sign=Math.sign)}catch(ignore){}module.exports=$sign||function sign(x){var n=Number(x);return 0===n||$isNaN(n)?n:n>0?1:-1}},{"is-nan":9}],16:[function(_dereq_,module,exports){"use strict";module.exports=9007199254740991},{}],17:[function(_dereq_,module,exports){"use strict";var has=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,slice=Array.prototype.slice,isArgs=_dereq_("./isArguments"),isEnumerable=Object.prototype.propertyIsEnumerable,hasDontEnumBug=!isEnumerable.call({toString:null},"toString"),hasProtoEnumBug=isEnumerable.call(function(){},"prototype"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],equalsConstructorPrototype=function(o){var ctor=o.constructor;return ctor&&ctor.prototype===o},excludedKeys={$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},hasAutomationEqualityBug=function(){if("undefined"==typeof window)return!1;for(var k in window)try{if(!excludedKeys["$"+k]&&has.call(window,k)&&null!==window[k]&&"object"==typeof window[k])try{equalsConstructorPrototype(window[k])}catch(e){return!0}}catch(e){return!0}return!1}(),equalsConstructorPrototypeIfNotBuggy=function(o){if("undefined"==typeof window||!hasAutomationEqualityBug)return equalsConstructorPrototype(o);try{return equalsConstructorPrototype(o)}catch(e){return!1}},keysShim=function keys(object){var isObject=null!==object&&"object"==typeof object,isFunction="[object Function]"===toStr.call(object),isArguments=isArgs(object),isString=isObject&&"[object String]"===toStr.call(object),theKeys=[];if(!isObject&&!isFunction&&!isArguments)throw new TypeError("Object.keys called on a non-object");var skipProto=hasProtoEnumBug&&isFunction;if(isString&&object.length>0&&!has.call(object,0))for(var i=0;i<object.length;++i)theKeys.push(String(i));if(isArguments&&object.length>0)for(var j=0;j<object.length;++j)theKeys.push(String(j));else for(var name in object)skipProto&&"prototype"===name||!has.call(object,name)||theKeys.push(String(name));if(hasDontEnumBug)for(var skipConstructor=equalsConstructorPrototypeIfNotBuggy(object),k=0;k<dontEnums.length;++k)skipConstructor&&"constructor"===dontEnums[k]||!has.call(object,dontEnums[k])||theKeys.push(dontEnums[k]);return theKeys};keysShim.shim=function shimObjectKeys(){if(Object.keys){if(!function(){return 2===(Object.keys(arguments)||"").length}(1,2)){var originalKeys=Object.keys;Object.keys=function keys(object){return originalKeys(isArgs(object)?slice.call(object):object)}}}else Object.keys=keysShim;return Object.keys||keysShim},module.exports=keysShim},{"./isArguments":18}],18:[function(_dereq_,module,exports){"use strict";var toStr=Object.prototype.toString;module.exports=function isArguments(value){var str=toStr.call(value),isArgs="[object Arguments]"===str;return isArgs||(isArgs="[object Array]"!==str&&null!==value&&"object"==typeof value&&"number"==typeof value.length&&value.length>=0&&"[object Function]"===toStr.call(value.callee)),isArgs}},{}],19:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for RequireObjectCoercible. | ||
@@ -57,3 +65,3 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible|7.2.1 RequireObjectCoercible ( argument )} | ||
*/ | ||
"use strict";var isNil=_dereq_("is-nil-x");module.exports=function RequireObjectCoercible(value){if(isNil(value))throw new TypeError("Cannot call method on "+value);return value}},{"is-nil-x":11}],18:[function(_dereq_,module,exports){/** | ||
"use strict";var isNil=_dereq_("is-nil-x");module.exports=function RequireObjectCoercible(value){if(isNil(value))throw new TypeError("Cannot call method on "+value);return value}},{"is-nil-x":12}],20:[function(_dereq_,module,exports){/** | ||
* @file ToInteger converts 'argument' to an integral numeric value. | ||
@@ -67,3 +75,3 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger|7.1.4 ToInteger ( argument )} | ||
*/ | ||
"use strict";var $isNaN=_dereq_("is-nan"),$isFinite=_dereq_("is-finite-x"),$sign=_dereq_("math-sign-x");module.exports=function ToInteger(value){var number=Number(value);return $isNaN(number)?0:0===number||!1===$isFinite(number)?number:$sign(number)*Math.floor(Math.abs(number))}},{"is-finite-x":6,"is-nan":8,"math-sign-x":13}],19:[function(_dereq_,module,exports){/** | ||
"use strict";var $isNaN=_dereq_("is-nan"),$isFinite=_dereq_("is-finite-x"),$sign=_dereq_("math-sign-x");module.exports=function ToInteger(value){var number=Number(value);return $isNaN(number)?0:0===number||!1===$isFinite(number)?number:$sign(number)*Math.floor(Math.abs(number))}},{"is-finite-x":7,"is-nan":9,"math-sign-x":15}],21:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for ToLength. | ||
@@ -77,3 +85,3 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tolength|7.1.15 ToLength ( argument )} | ||
*/ | ||
"use strict";var toInteger=_dereq_("to-integer-x"),MAX_SAFE_INTEGER=_dereq_("max-safe-integer");module.exports=function ToLength(value){var len=toInteger(value);return len<=0?0:len>MAX_SAFE_INTEGER?MAX_SAFE_INTEGER:len}},{"max-safe-integer":14,"to-integer-x":18}],20:[function(_dereq_,module,exports){/** | ||
"use strict";var toInteger=_dereq_("to-integer-x"),MAX_SAFE_INTEGER=_dereq_("max-safe-integer");module.exports=function ToLength(value){var len=toInteger(value);return len<=0?0:len>MAX_SAFE_INTEGER?MAX_SAFE_INTEGER:len}},{"max-safe-integer":16,"to-integer-x":20}],22:[function(_dereq_,module,exports){/** | ||
* @file ES6-compliant shim for ToObject. | ||
@@ -87,2 +95,2 @@ * @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-toobject|7.1.13 ToObject ( argument )} | ||
*/ | ||
"use strict";var $requireObjectCoercible=_dereq_("require-object-coercible-x");module.exports=function ToObject(value){return Object($requireObjectCoercible(value))}},{"require-object-coercible-x":17}],21:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}]},{},[1])(1)}); | ||
"use strict";var $requireObjectCoercible=_dereq_("require-object-coercible-x");module.exports=function ToObject(value){return Object($requireObjectCoercible(value))}},{"require-object-coercible-x":19}],23:[function(_dereq_,module,exports){"use strict";module.exports=function isUndefined(value){return void 0===value}},{}]},{},[1])(1)}); |
{ | ||
"name": "object-keys-x", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An ES6 Object.keys shim.", | ||
@@ -33,3 +33,3 @@ "homepage": "https://github.com/Xotic750/object-keys-x", | ||
"dependencies": { | ||
"array-slice-x": "^1.1.0", | ||
"array-slice-x": "^2.0.0", | ||
"is-arguments": "^1.0.2", | ||
@@ -36,0 +36,0 @@ "object-keys": "^1.0.11", |
@@ -26,3 +26,3 @@ <a href="https://travis-ci.org/Xotic750/object-keys-x" | ||
**Version**: 1.1.0 | ||
**Version**: 1.2.0 | ||
**Author**: Xotic750 <Xotic750@gmail.com> | ||
@@ -29,0 +29,0 @@ **License**: [MIT](<https://opensource.org/licenses/MIT>) |
Sorry, the diff of this file is not supported yet
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
object-keys |
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
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
73179
1209
1
+ Addedarray-slice-x@2.2.0(transitive)
+ Addedhas-boxed-string-x@1.1.1(transitive)
+ Addedis-string@1.0.7(transitive)
- Removedarray-slice-x@1.2.0(transitive)
Updatedarray-slice-x@^2.0.0