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

es5-ext

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es5-ext - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

lib/Array/prototype/is-copy.js

16

lib/Array/prototype/diff.js
'use strict';
var value = require('../../Object/valid-value')
, copy = require('./copy')
, contains = require('./contains')
, remove = require('./remove')

@@ -11,12 +9,6 @@ , filter = Array.prototype.filter;

module.exports = function (other) {
var r;
if ((value(this).length >>> 0) > (value(other).length >>> 0)) {
r = copy.call(this);
remove.apply(r, other);
return r;
} else {
return filter.call(this, function (item) {
return !contains.call(other, item);
});
}
value(this) && value(other);
return filter.call(this, function (item) {
return !contains.call(other, item);
});
};

@@ -22,2 +22,4 @@ 'use strict';

intersection: require('./intersection'),
isCopy: require('./is-copy'),
isUniq: require('./is-uniq'),
last: require('./last'),

@@ -24,0 +26,0 @@ lastIndex: require('./last-index'),

'use strict';
module.exports = {
custom: require('./custom'),
isError: require('./is-error'),

@@ -5,0 +6,0 @@ prototype: require('./prototype'),

@@ -6,12 +6,13 @@ // Export all modules.

module.exports = {
i: require('./i'),
insert: require('./insert'),
invoke: require('./invoke'),
isArguments: require('./is-arguments'),
isFunction: require('./is-function'),
k: require('./k'),
noop: require('./noop'),
pluck: require('./pluck'),
prototype: require('./prototype'),
remove: require('./remove')
i: require('./i'),
insert: require('./insert'),
invoke: require('./invoke'),
isArguments: require('./is-arguments'),
isFunction: require('./is-function'),
k: require('./k'),
noop: require('./noop'),
pluck: require('./pluck'),
prototype: require('./prototype'),
remove: require('./remove'),
validFunction: require('./valid-function')
};

@@ -16,3 +16,3 @@ // Internal method, used by iteration functions.

var list, thisArg = arguments[2], compareFn = arguments[3];
value(obj);
obj = Object(value(obj));
callable(cb);

@@ -19,0 +19,0 @@

'use strict';
var keys = Object.keys
var value = require('./valid-value')
, keys = Object.keys
, unset = function (key) { delete this[key]; };
module.exports = function (obj) {
keys(obj).forEach(unset, obj);
keys(Object(value(obj))).forEach(unset, obj);
return obj;
};
'use strict';
var keys = Object.keys;
var value = require('./valid-value')
, keys = Object.keys;
module.exports = function (obj) {
return keys(obj).length;
return keys(Object(value(obj))).length;
};

@@ -5,4 +5,10 @@ 'use strict';

, callable = require('./valid-callable')
, validValue = require('./valid-value')
, copy = require('./copy')
, map = require('./map')
, isString = require('../String/is-string')
, contains = require('../String/prototype/contains')
, bind = Function.prototype.bind
, defineProperty = Object.defineProperty
, d;

@@ -48,1 +54,18 @@

};
d.binder = function self(name, dv) {
var value, dgs;
if (!isString(name)) {
return map(name, function (dv, name) { return self(name, dv); });
}
value = validValue(dv) && callable(dv.value);
dgs = copy(dv);
delete dgs.writable;
delete dgs.value;
dgs.get = function () {
dv.value = bind.call(value, this);
defineProperty(this, name, dv);
return this[name];
};
return dgs;
};

@@ -5,2 +5,3 @@ 'use strict';

, intersection = require('../Array/prototype/intersection')
, value = require('./valid-value')
, isObject = require('./is-object')

@@ -11,3 +12,3 @@

module.exports = function (obj, target) {
var k1 = keys(obj), k2 = keys(target);
var k1 = keys(Object(value(obj))), k2 = keys(Object(value(target)));
return [diff.call(k1, k2), intersection.call(k1, k2).filter(function (key) {

@@ -14,0 +15,0 @@ return (isObject(obj[key]) && isObject(target[key])) ?

'use strict';
var value = require('./valid-value')
var value = require('./valid-value')

@@ -5,0 +5,0 @@ , forEach = Array.prototype.forEach, slice = Array.prototype.slice

@@ -11,3 +11,3 @@ 'use strict';

extend = function (src) {
keys(src).forEach(function (key) {
keys(Object(src)).forEach(function (key) {
this[key] = src[key];

@@ -14,0 +14,0 @@ }, this);

@@ -11,4 +11,4 @@ 'use strict';

callable(cb);
forEach(obj, function (value, key) {
if (call.call(cb, thisArg, value, key)) {
forEach(obj, function (value, key, obj, index) {
if (call.call(cb, thisArg, value, key, obj, index)) {
o[key] = obj[key];

@@ -15,0 +15,0 @@ }

'use strict';
var uniq = require('../Array/prototype/uniq')
var uniq = require('../Array/prototype/uniq')
, value = require('./valid-value')

@@ -10,3 +11,5 @@ , push = Array.prototype.push

module.exports = function (obj) {
var keys = getOwnPropertyNames(obj);
var keys;
obj = Object(value(obj));
keys = getOwnPropertyNames(obj);
while ((obj = getPrototypeOf(obj))) {

@@ -13,0 +16,0 @@ push.apply(keys, getOwnPropertyNames(obj));

@@ -13,2 +13,3 @@ 'use strict';

extend: require('./extend'),
extendDeep: require('./extend-deep'),
extendProperties: require('./extend-properties'),

@@ -31,2 +32,3 @@ filter: require('./filter'),

reduce: require('./reduce'),
safeTraverse: require('./safe-traverse'),
some: require('./some'),

@@ -33,0 +35,0 @@ toPlainObject: require('./to-plain-object'),

@@ -9,7 +9,5 @@ 'use strict';

for (i in obj) { //jslint: skip
if (obj.propertyIsEnumerable(i)) {
return false;
}
if (obj.propertyIsEnumerable(i)) return false;
}
return true;
};

@@ -11,6 +11,6 @@ 'use strict';

callable(cb);
forEach(obj, function (value, key) {
o[call.call(cb, thisArg, key, value, this)] = value;
forEach(obj, function (value, key, obj, index) {
o[call.call(cb, thisArg, key, value, this, index)] = value;
}, obj);
return o;
};

@@ -6,12 +6,14 @@ 'use strict';

, call = Function.prototype.call
, defaultCb = function (value, key) { return [key, value]; };
module.exports = function (obj, cb/*, thisArg*/) {
module.exports = function (obj, cb/*, thisArg, compareFn*/) {
var a = [], thisArg = arguments[2];
cb = (cb == null) ? defaultCb : callable(cb);
forEach(obj, function (value, key) {
a.push(cb.call(thisArg, value, key, this));
forEach(obj, function (value, key, obj, index) {
a.push(call.call(cb, thisArg, value, key, this, index));
}, obj, arguments[3]);
return a;
};

@@ -11,6 +11,6 @@ 'use strict';

callable(cb);
forEach(obj, function (value, key) {
o[key] = call.call(cb, thisArg, value, key, obj);
forEach(obj, function (value, key, obj, index) {
o[key] = call.call(cb, thisArg, value, key, obj, index);
});
return o;
};

@@ -13,2 +13,3 @@ 'use strict';

obj = Object(obj);
initial = arguments[2];

@@ -15,0 +16,0 @@ compareFn = arguments[3];

@@ -23,6 +23,4 @@ 'use strict';

var obj = {};
if (!src || !isObject(src)) {
return obj;
}
if (!src || !isObject(src)) return obj;
return extend(obj, src);
};
'use strict';
var keys = Object.keys
var value = require('./valid-value')
, keys = Object.keys
, get = function (key) { return this[key]; };
module.exports = function (obj) { return keys(obj).map(get, obj); };
module.exports = function (obj) {
return keys(Object(value(obj))).map(get, obj);
};
'use strict';
module.exports = {
isRegExp: require('./is-reg-exp')
isRegExp: require('./is-reg-exp'),
validRegExp: require('./valid-reg-exp')
};

@@ -5,2 +5,3 @@ 'use strict';

camelToHyphen: require('./camel-to-hyphen'),
capitalize: require('./capitalize'),
caseInsensitiveCompare: require('./case-insensitive-compare'),

@@ -15,4 +16,5 @@ contains: require('./contains'),

repeat: require('./repeat'),
simpleReplace: require('./simple-replace'),
startsWith: require('./starts-with'),
trimCommonLeft: require('./trim-common-left')
};
{
"name": "es5-ext",
"version": "0.9.1",
"version": "0.9.2",
"description": "ECMAScript5 extensions",

@@ -5,0 +5,0 @@ "keywords": [

@@ -160,2 +160,10 @@ # es5-ext - ECMAScript5 extensions

### isCopy(other)
Returns true if both context and _other_ lists have same content
### isUniq()
Returns true if all values in array are unique
### last()

@@ -304,2 +312,6 @@

### validFunction(arg)
If given object is not function throw TypeError in other case return it.
## Function Prototype extensions

@@ -442,2 +454,6 @@

### extendDeep(dest[, …src])
Extend _dest_ by enumerable own properties of other objects. Properties found in both objects will be overwritten with exception of plain objects which again reiterated so only matching properties from other nested plain objects are affected
### extendProperties(dest[, …src])

@@ -524,4 +540,8 @@

Optionally _compareFn_ can be provided which assures that object keys are iterated in given order. If _compareFn_ is equal to `true`, then order is alphabetical (by key).
If we need to provide _compareFn_ but don't want to provide _initial_ value, then we have to pass reduce.NO_INITIAL as initial argument.
If we need to provide _compareFn_ but don't want to provide _initial_ value, then we have to pass `reduce.NO_INITIAL` as initial argument.
### safeTraverse(obj[, …names])
Save navigation of object properties. See http://wiki.ecmascript.org/doku.php?id=strawman:existential_operator
### some(obj, cb[, thisArg[, compareFn]])

@@ -569,2 +589,6 @@

### capitalize()
Capitalize first character of a string
### caseInsensitiveCompare(str)

@@ -619,2 +643,6 @@

### simpleReplace(search, replace)
Simple `replace` version. Doesn't support regular expressions. Replaces just first occurence of search string. Doesn't support insert patterns, therefore it is safe to replace text with text obtained programmatically (there's no need for additional _$_ characters escape in such case).
### startsWith(searchString[, position])

@@ -621,0 +649,0 @@

@@ -30,2 +30,18 @@ 'use strict';

a.deep(arr, [3, 2, 1], "Sort by Values: Order");
arr = [];
o2 = {};
i = -1;
t('raz', function (value, name, self, index) {
arr.push(value);
o2[name] = value;
a(index, ++i, "Primitive: Index");
a(typeof self, 'object', "Primitive: Self type");
a(String(self), 'raz', "Primitive: Self value");
a(this, o3, "Scope");
}, o3, function (a, b) {
return a - b;
});
a.deep(o2, Object('raz'), "Primitive: Sort by Values: Content");
a.deep(arr, ['r', 'a', 'z'], "Primitive: Sort by Values: Order");
};
'use strict';
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

@@ -139,3 +141,2 @@ module.exports = function (t, a) {

},
d: function (a) {

@@ -157,4 +158,17 @@ var d = getOwnPropertyDescriptor(o, 'df');

a(d.writable, undefined, "GS Writable");
},
binder: function (a) {
var o = {};
defineProperty(o, 'foo', t.binder('foo',
t(function () { return this; })));
a((o.foo)(), o, "Single");
defineProperties(o, t.binder({
bar: t(function () { return this === o; }),
bar2: t(function () { return this; })
}));
a.deep([(o.bar)(), (o.bar2)()], [true, o], "Multiple");
}
};
};

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

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