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

unchanged

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unchanged - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # unchanged CHANGELOG

## 2.1.0
- Add [not](README.md#not) and [notWith](README.md#notwith) methods
- Ensure that objects with custom prototypes always use the same creator
## 2.0.1

@@ -7,0 +12,0 @@

40

dist/unchanged.cjs.js

@@ -15,6 +15,2 @@ 'use strict';

/**
* @constant FUNCTION_NAME the RegExp expression matching function names
*/
var FUNCTION_NAME = /^\s*function\s*([^\(]*)/i;
/**
* @constant REACT_ELEMENT the symbol / number specific to react elements

@@ -102,2 +98,12 @@ */

/**
* @function createWithProto
*
* @description
* create a new object with the prototype of the object passed
*
* @param object object whose prototype will be the new object's prototype
* @returns object with the prototype of the one passed
*/
var createWithProto = function (object) { return create(object.__proto__ || getPrototypeOf(object)); };
/**
* @function isCloneable

@@ -143,4 +149,3 @@ *

return typeof fn === 'function' &&
// @ts-ignore
global[fn.name || toStringFunction.call(fn).split(FUNCTION_NAME)[1]] === fn;
!!~toStringFunction.call(fn).indexOf('[native code]');
};

@@ -201,3 +206,3 @@ /**

? {}
: assign(create(object.__proto__ || getPrototypeOf(object)), object);
: assign(createWithProto(object), object);
};

@@ -329,3 +334,3 @@ /**

? {}
: create(target.__proto__);
: createWithProto(target);
return reduce(getOwnProperties(source), function (clone, key) {

@@ -623,2 +628,17 @@ clone[key] =

/**
* @function createNot
*
* @description
* create handlers for not / notWith
*
* @param isWithHandler not the method using a with handler
* @returns not / notWithHandler
*/
var createNot = function (isWithHandler) {
var is = createIs(isWithHandler);
return function () {
return !is.apply(this, arguments);
};
};
/**
* @function createRemove

@@ -738,2 +758,4 @@ *

var mergeWith = curriable.curry(createMerge(true, true), 3);
var not = curriable.curry(createNot(false), 3);
var notWith = curriable.curry(createNot(true), 4);
var remove = curriable.curry(createRemove(false), 2);

@@ -761,2 +783,4 @@ var removeWith = curriable.curry(createRemove(true), 3);

exports.mergeWith = mergeWith;
exports.not = not;
exports.notWith = notWith;
exports.remove = remove;

@@ -763,0 +787,0 @@ exports.removeWith = removeWith;

40

dist/unchanged.esm.js

@@ -12,6 +12,2 @@ import { curry } from 'curriable';

/**
* @constant FUNCTION_NAME the RegExp expression matching function names
*/
var FUNCTION_NAME = /^\s*function\s*([^\(]*)/i;
/**
* @constant REACT_ELEMENT the symbol / number specific to react elements

@@ -99,2 +95,12 @@ */

/**
* @function createWithProto
*
* @description
* create a new object with the prototype of the object passed
*
* @param object object whose prototype will be the new object's prototype
* @returns object with the prototype of the one passed
*/
var createWithProto = function (object) { return create(object.__proto__ || getPrototypeOf(object)); };
/**
* @function isCloneable

@@ -140,4 +146,3 @@ *

return typeof fn === 'function' &&
// @ts-ignore
global[fn.name || toStringFunction.call(fn).split(FUNCTION_NAME)[1]] === fn;
!!~toStringFunction.call(fn).indexOf('[native code]');
};

@@ -198,3 +203,3 @@ /**

? {}
: assign(create(object.__proto__ || getPrototypeOf(object)), object);
: assign(createWithProto(object), object);
};

@@ -326,3 +331,3 @@ /**

? {}
: create(target.__proto__);
: createWithProto(target);
return reduce(getOwnProperties(source), function (clone, key) {

@@ -620,2 +625,17 @@ clone[key] =

/**
* @function createNot
*
* @description
* create handlers for not / notWith
*
* @param isWithHandler not the method using a with handler
* @returns not / notWithHandler
*/
var createNot = function (isWithHandler) {
var is = createIs(isWithHandler);
return function () {
return !is.apply(this, arguments);
};
};
/**
* @function createRemove

@@ -735,2 +755,4 @@ *

var mergeWith = curry(createMerge(true, true), 3);
var not = curry(createNot(false), 3);
var notWith = curry(createNot(true), 4);
var remove = curry(createRemove(false), 2);

@@ -741,3 +763,3 @@ var removeWith = curry(createRemove(true), 3);

export { add, addWith, assign$1 as assign, assignWith, call, callWith, get, getOr, getWith, getWithOr, has, hasWith, is, isWith, merge, mergeWith, remove, removeWith, set, setWith };
export { add, addWith, assign$1 as assign, assignWith, call, callWith, get, getOr, getWith, getWithOr, has, hasWith, is, isWith, merge, mergeWith, not, notWith, remove, removeWith, set, setWith };
//# sourceMappingURL=unchanged.esm.js.map

@@ -14,6 +14,2 @@ (function (global, factory) {

/**
* @constant FUNCTION_NAME the RegExp expression matching function names
*/
var FUNCTION_NAME = /^\s*function\s*([^\(]*)/i;
/**
* @constant REACT_ELEMENT the symbol / number specific to react elements

@@ -101,2 +97,12 @@ */

/**
* @function createWithProto
*
* @description
* create a new object with the prototype of the object passed
*
* @param object object whose prototype will be the new object's prototype
* @returns object with the prototype of the one passed
*/
var createWithProto = function (object) { return create(object.__proto__ || getPrototypeOf(object)); };
/**
* @function isCloneable

@@ -142,4 +148,3 @@ *

return typeof fn === 'function' &&
// @ts-ignore
global[fn.name || toStringFunction.call(fn).split(FUNCTION_NAME)[1]] === fn;
!!~toStringFunction.call(fn).indexOf('[native code]');
};

@@ -200,3 +205,3 @@ /**

? {}
: assign(create(object.__proto__ || getPrototypeOf(object)), object);
: assign(createWithProto(object), object);
};

@@ -328,3 +333,3 @@ /**

? {}
: create(target.__proto__);
: createWithProto(target);
return reduce(getOwnProperties(source), function (clone, key) {

@@ -622,2 +627,17 @@ clone[key] =

/**
* @function createNot
*
* @description
* create handlers for not / notWith
*
* @param isWithHandler not the method using a with handler
* @returns not / notWithHandler
*/
var createNot = function (isWithHandler) {
var is = createIs(isWithHandler);
return function () {
return !is.apply(this, arguments);
};
};
/**
* @function createRemove

@@ -737,2 +757,4 @@ *

var mergeWith = curriable.curry(createMerge(true, true), 3);
var not = curriable.curry(createNot(false), 3);
var notWith = curriable.curry(createNot(true), 4);
var remove = curriable.curry(createRemove(false), 2);

@@ -760,2 +782,4 @@ var removeWith = curriable.curry(createRemove(true), 3);

exports.mergeWith = mergeWith;
exports.not = not;
exports.notWith = notWith;
exports.remove = remove;

@@ -762,0 +786,0 @@ exports.removeWith = removeWith;

@@ -1,1 +0,1 @@

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("curriable"),require("pathington")):"function"==typeof define&&define.amd?define(["exports","curriable","pathington"],r):r((n=n||self).unchanged={},n.curriable,n.pathington)}(this,function(n,r,t){"use strict";var o=Object,u=o.create,c=o.getOwnPropertySymbols,e=o.getPrototypeOf,i=o.keys,f=o.propertyIsEnumerable,a=o.prototype.toString,l=Function.prototype.toString,p=Array.isArray,y=/^\s*function\s*([^\(]*)/i,v="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("react.element"):60103,d=function(n,r,t){for(var o=t,u=0;u<n.length;u++)o=r(o,n[u]);return o},s=function(n){var r=c(n);return r.length?i(n).concat(d(r,function(r,t){return f.call(n,t)&&r.push(t),r},[])):i(n)},h="function"==typeof o.assign?o.assign:function(n,r){return r?d(s(r),function(n,t){return n[t]=r[t],n},Object(n)):n},g=function(n){if(!n||"object"!=typeof n||n.$$typeof===v)return!1;var r=a.call(n);return"[object Date]"!==r&&"[object RegExp]"!==r},b=function(n){return null==n||p(n)&&!n.length},m=function(n){return"function"==typeof n&&global[n.name||l.call(n).split(y)[1]]===n},_=function(n,r,t){return"function"==typeof n?n.apply(r,t):void 0},W=function(n){return p(n)?[]:{}},j=function(n){return n.constructor===o?h({},n):p(n)?function(n){for(var r=new n.constructor,t=0;t<n.length;t++)r[t]=n[t];return r}(n):m(n.constructor)?{}:h(u(n.__proto__||e(n)),n)},O=function(n,r){return n===r||n!=n&&r!=r},S=function(n,r){return g(n)?j(n):"number"==typeof r?[]:{}},A=function(n,r){return void 0===n?r:n},w=function(n){return p(n)?n:t.parse(n)},x=function(n,r,t,o){var u=n[o],c=o+1;return c===n.length?t(r,u):r[u]=x(n,S(r[u],n[c]),t,c),r},E=function(n,r,t){var o=w(n),u=S(r,o[0]);return 1===o.length?(t(u,o[0]),u):x(o,u,t,0)},P=function(n,r,t){var c,e=p(n);if(e!==p(r)||!g(n))return g(c=r)?j(c):c;if(e)return n.concat(r);var i=n.constructor===o||m(n.constructor)?{}:u(n.__proto__);return d(s(r),function(o,u){return o[u]=t&&g(r[u])?P(n[u],r[u],t):r[u],o},h(i,n))},q=function(n,r,t){var o=w(n);if(1===o.length)return r?A(r[o[0]],t):t;for(var u=r,c=o[0],e=0;e<o.length-1;e++){if(!u||!u[c])return t;u=u[c],c=o[e+1]}return u?A(u[c],t):t},$=function(n,r,t){var o=b(n),u=o?r:t?t(q(n,r)):q(n,r);return p(u)?p(n)?n.concat([u.length]):(o?"":n)+"["+u.length+"]":n},k=function(n,r){if(n.length){for(var t=n.length,o=r;o<t-1;)n[o]=n[o+1],++o;--n.length}},D=function(){throw new TypeError('handler passed is not of type "function".')},F=Array.isArray,I=Array.prototype.slice,M=function(n){return n?function(n,r,t,o,u){void 0===u&&(u=o),"function"!=typeof n&&D();var c=I.call(arguments,5);if(b(r))return _(n.apply(void 0,[o].concat(c)),u,t);var e=q(r,o);if(void 0!==e){var i=n.apply(void 0,[e].concat(c));return _(i,u,t)}}:function(n,r,t,o){void 0===o&&(o=t);var u=b(n)?t:q(n,t);return _(u,o,r)}},R=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,4);if(b(r))return n.apply(void 0,[t].concat(o));var u=q(r,t);return void 0===u?u:n.apply(void 0,[u].concat(o))}:function(n,r){return b(n)?r:q(n,r)}},T=function(n){return n?function(n,r,t,o){"function"!=typeof n&&D();var u=I.call(arguments,4);if(b(t))return n.apply(void 0,[o].concat(u));var c=q(t,o);return void 0===c?r:n.apply(void 0,[c].concat(u))}:function(n,r,t){return b(r)?t:q(r,t,n)}},z=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,3);if(b(r))return!!n.apply(void 0,[t].concat(o));var u=q(r,t);return void 0!==u&&!!n.apply(void 0,[u].concat(o))}:function(n,r){return b(n)?null!=r:void 0!==q(n,r)}},B=function(n){return n?function(n,r,t,o){"function"!=typeof n&&D();var u=I.call(arguments,4);return b(r)?O(n.apply(void 0,[o].concat(u)),t):O(n.apply(void 0,[q(r,o)].concat(u)),t)}:function(n,r,t){return b(n)?O(t,r):O(q(n,t),r)}},C=function(n,r){return n?function(n,t,o){"function"!=typeof n&&D();var u=I.call(arguments,3);if(!g(o))return n.apply(void 0,[o].concat(u));if(b(t)){var c=n.apply(void 0,[o].concat(u));return c?P(o,c,r):o}var e=!1,i=E(t,o,function(t,o){var c=n.apply(void 0,[t[o]].concat(u));c&&(t[o]=P(t[o],c,r),e=!0)});return e?i:o}:function(n,t,o){return g(o)?b(n)?P(o,t,!0):E(n,o,function(n,o){n[o]=P(n[o],t,r)}):t}},G=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,3);if(b(r)){var u=W(t);return n.apply(void 0,[u].concat(o))?u:t}var c=q(r,t);return void 0!==c&&n.apply(void 0,[c].concat(o))?E(r,t,function(n,r){F(n)?k(n,r):delete n[r]}):t}:function(n,r){return b(n)?W(r):void 0!==q(n,r)?E(n,r,function(n,r){F(n)?k(n,r):delete n[r]}):r}},H=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,3);return b(r)?n.apply(void 0,[t].concat(o)):E(r,t,function(r,t){r[t]=n.apply(void 0,[r[t]].concat(o))})}:function(n,r,t){return b(n)?r:E(n,t,function(n,t){n[t]=r})}},J=function(n){var r=H(n);return n?function(n,t,o){return r.apply(this,[n,$(t,o,n),o].concat(I.call(arguments,3)))}:function(n,t,o){return r($(n,o),t,o)}},K=r.curry(J(!1),3),L=r.curry(J(!0),3),N=r.curry(C(!1,!1),3),Q=r.curry(C(!0,!1),3),U=r.curry(M(!1),3),V=r.curry(M(!0),4),X=r.curry(R(!1),2),Y=r.curry(T(!1),3),Z=r.curry(R(!0),3),nn=r.curry(T(!0),4),rn=r.curry(z(!1),2),tn=r.curry(z(!0),3),on=r.curry(B(!1),3),un=r.curry(B(!0),4),cn=r.curry(C(!1,!0),3),en=r.curry(C(!0,!0),3),fn=r.curry(G(!1),2),an=r.curry(G(!0),3),ln=r.curry(H(!1),3),pn=r.curry(H(!0),3);n.__=r.__,n.add=K,n.addWith=L,n.assign=N,n.assignWith=Q,n.call=U,n.callWith=V,n.get=X,n.getOr=Y,n.getWith=Z,n.getWithOr=nn,n.has=rn,n.hasWith=tn,n.is=on,n.isWith=un,n.merge=cn,n.mergeWith=en,n.remove=fn,n.removeWith=an,n.set=ln,n.setWith=pn,Object.defineProperty(n,"__esModule",{value:!0})});
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("curriable"),require("pathington")):"function"==typeof define&&define.amd?define(["exports","curriable","pathington"],r):r((n=n||self).unchanged={},n.curriable,n.pathington)}(this,function(n,r,t){"use strict";var o=Object,u=o.create,c=o.getOwnPropertySymbols,e=o.getPrototypeOf,i=o.keys,f=o.propertyIsEnumerable,a=o.prototype.toString,p=Function.prototype.toString,l=Array.isArray,y="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("react.element"):60103,v=function(n,r,t){for(var o=t,u=0;u<n.length;u++)o=r(o,n[u]);return o},d=function(n){var r=c(n);return r.length?i(n).concat(v(r,function(r,t){return f.call(n,t)&&r.push(t),r},[])):i(n)},s="function"==typeof o.assign?o.assign:function(n,r){return r?v(d(r),function(n,t){return n[t]=r[t],n},Object(n)):n},h=function(n){return u(n.__proto__||e(n))},g=function(n){if(!n||"object"!=typeof n||n.$$typeof===y)return!1;var r=a.call(n);return"[object Date]"!==r&&"[object RegExp]"!==r},b=function(n){return null==n||l(n)&&!n.length},m=function(n){return"function"==typeof n&&!!~p.call(n).indexOf("[native code]")},W=function(n,r,t){return"function"==typeof n?n.apply(r,t):void 0},_=function(n){return l(n)?[]:{}},O=function(n){return n.constructor===o?s({},n):l(n)?function(n){for(var r=new n.constructor,t=0;t<n.length;t++)r[t]=n[t];return r}(n):m(n.constructor)?{}:s(h(n),n)},j=function(n,r){return n===r||n!=n&&r!=r},S=function(n,r){return g(n)?O(n):"number"==typeof r?[]:{}},x=function(n,r){return void 0===n?r:n},A=function(n){return l(n)?n:t.parse(n)},w=function(n,r,t,o){var u=n[o],c=o+1;return c===n.length?t(r,u):r[u]=w(n,S(r[u],n[c]),t,c),r},E=function(n,r,t){var o=A(n),u=S(r,o[0]);return 1===o.length?(t(u,o[0]),u):w(o,u,t,0)},P=function(n,r,t){var u,c=l(n);if(c!==l(r)||!g(n))return g(u=r)?O(u):u;if(c)return n.concat(r);var e=n.constructor===o||m(n.constructor)?{}:h(n);return v(d(r),function(o,u){return o[u]=t&&g(r[u])?P(n[u],r[u],t):r[u],o},s(e,n))},q=function(n,r,t){var o=A(n);if(1===o.length)return r?x(r[o[0]],t):t;for(var u=r,c=o[0],e=0;e<o.length-1;e++){if(!u||!u[c])return t;u=u[c],c=o[e+1]}return u?x(u[c],t):t},$=function(n,r,t){var o=b(n),u=o?r:t?t(q(n,r)):q(n,r);return l(u)?l(n)?n.concat([u.length]):(o?"":n)+"["+u.length+"]":n},k=function(n,r){if(n.length){for(var t=n.length,o=r;o<t-1;)n[o]=n[o+1],++o;--n.length}},D=function(){throw new TypeError('handler passed is not of type "function".')},F=Array.isArray,I=Array.prototype.slice,M=function(n){return n?function(n,r,t,o,u){void 0===u&&(u=o),"function"!=typeof n&&D();var c=I.call(arguments,5);if(b(r))return W(n.apply(void 0,[o].concat(c)),u,t);var e=q(r,o);if(void 0!==e){var i=n.apply(void 0,[e].concat(c));return W(i,u,t)}}:function(n,r,t,o){void 0===o&&(o=t);var u=b(n)?t:q(n,t);return W(u,o,r)}},R=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,4);if(b(r))return n.apply(void 0,[t].concat(o));var u=q(r,t);return void 0===u?u:n.apply(void 0,[u].concat(o))}:function(n,r){return b(n)?r:q(n,r)}},T=function(n){return n?function(n,r,t,o){"function"!=typeof n&&D();var u=I.call(arguments,4);if(b(t))return n.apply(void 0,[o].concat(u));var c=q(t,o);return void 0===c?r:n.apply(void 0,[c].concat(u))}:function(n,r,t){return b(r)?t:q(r,t,n)}},z=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,3);if(b(r))return!!n.apply(void 0,[t].concat(o));var u=q(r,t);return void 0!==u&&!!n.apply(void 0,[u].concat(o))}:function(n,r){return b(n)?null!=r:void 0!==q(n,r)}},B=function(n){return n?function(n,r,t,o){"function"!=typeof n&&D();var u=I.call(arguments,4);return b(r)?j(n.apply(void 0,[o].concat(u)),t):j(n.apply(void 0,[q(r,o)].concat(u)),t)}:function(n,r,t){return b(n)?j(t,r):j(q(n,t),r)}},C=function(n,r){return n?function(n,t,o){"function"!=typeof n&&D();var u=I.call(arguments,3);if(!g(o))return n.apply(void 0,[o].concat(u));if(b(t)){var c=n.apply(void 0,[o].concat(u));return c?P(o,c,r):o}var e=!1,i=E(t,o,function(t,o){var c=n.apply(void 0,[t[o]].concat(u));c&&(t[o]=P(t[o],c,r),e=!0)});return e?i:o}:function(n,t,o){return g(o)?b(n)?P(o,t,!0):E(n,o,function(n,o){n[o]=P(n[o],t,r)}):t}},G=function(n){var r=B(n);return function(){return!r.apply(this,arguments)}},H=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,3);if(b(r)){var u=_(t);return n.apply(void 0,[u].concat(o))?u:t}var c=q(r,t);return void 0!==c&&n.apply(void 0,[c].concat(o))?E(r,t,function(n,r){F(n)?k(n,r):delete n[r]}):t}:function(n,r){return b(n)?_(r):void 0!==q(n,r)?E(n,r,function(n,r){F(n)?k(n,r):delete n[r]}):r}},J=function(n){return n?function(n,r,t){"function"!=typeof n&&D();var o=I.call(arguments,3);return b(r)?n.apply(void 0,[t].concat(o)):E(r,t,function(r,t){r[t]=n.apply(void 0,[r[t]].concat(o))})}:function(n,r,t){return b(n)?r:E(n,t,function(n,t){n[t]=r})}},K=function(n){var r=J(n);return n?function(n,t,o){return r.apply(this,[n,$(t,o,n),o].concat(I.call(arguments,3)))}:function(n,t,o){return r($(n,o),t,o)}},L=r.curry(K(!1),3),N=r.curry(K(!0),3),Q=r.curry(C(!1,!1),3),U=r.curry(C(!0,!1),3),V=r.curry(M(!1),3),X=r.curry(M(!0),4),Y=r.curry(R(!1),2),Z=r.curry(T(!1),3),nn=r.curry(R(!0),3),rn=r.curry(T(!0),4),tn=r.curry(z(!1),2),on=r.curry(z(!0),3),un=r.curry(B(!1),3),cn=r.curry(B(!0),4),en=r.curry(C(!1,!0),3),fn=r.curry(C(!0,!0),3),an=r.curry(G(!1),3),pn=r.curry(G(!0),4),ln=r.curry(H(!1),2),yn=r.curry(H(!0),3),vn=r.curry(J(!1),3),dn=r.curry(J(!0),3);n.__=r.__,n.add=L,n.addWith=N,n.assign=Q,n.assignWith=U,n.call=V,n.callWith=X,n.get=Y,n.getOr=Z,n.getWith=nn,n.getWithOr=rn,n.has=tn,n.hasWith=on,n.is=un,n.isWith=cn,n.merge=en,n.mergeWith=fn,n.not=an,n.notWith=pn,n.remove=ln,n.removeWith=yn,n.set=vn,n.setWith=dn,Object.defineProperty(n,"__esModule",{value:!0})});

@@ -122,2 +122,16 @@ declare namespace unchanged {

export function not(
path: unchanged.Path,
value: any,
object: unchanged.Unchangeable,
): boolean;
export function notWith(
fn: unchanged.withHandler,
path: unchanged.Path,
value: any,
object: unchanged.Unchangeable,
...extraArgs: any[]
): boolean;
export function remove(

@@ -124,0 +138,0 @@ path: unchanged.Path,

@@ -80,3 +80,3 @@ {

"types": "dist/index.d.ts",
"version": "2.0.1"
"version": "2.1.0"
}

@@ -18,2 +18,3 @@ # unchanged

- [is](#is)
- [not](#not)
- [add](#add)

@@ -30,2 +31,3 @@ - [merge](#merge)

- [isWith](#iswith)
- [notWith](#notwith)
- [addWith](#addwith)

@@ -255,3 +257,3 @@ - [mergeWith](#mergewith)

Returns `true` if the value at the `path` in `object` is equal to `value` based on [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) equality.
Returns `true` if the value at the `path` in `object` is equal to `value` based on [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) equality, `false` otherwise.

@@ -269,5 +271,31 @@ ```typescript

console.log(is(["foo", 0, "bar"], "baz", object)); // true
console.log(is("foo[0].bar", "quz', object)); // false
console.log(is("foo[0].bar", "quz", object)); // false
```
### not
```typescript
function not(
path: unchanged.Path,
value: any,
object: unchanged.Unchangeable
): boolean;
```
Returns `false` if the value at the `path` in `object` is equal to `value` based on [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) equality, `true` otherwise.
```typescript
const object: unchanged.Unchangeable = {
foo: [
{
bar: "baz"
}
]
};
console.log(not("foo[0].bar", "baz", object)); // false
console.log(not(["foo", 0, "bar"], "baz", object)); // false
console.log(not("foo[0].bar", "quz", object)); // true
```
### add

@@ -678,3 +706,3 @@

Returns `true` if the return value of `fn` based on the value returned from `path` in the `object` is equal to `value` based on [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) equality.
Returns `true` if the return value of `fn` based on the value returned from `path` in the `object` is equal to `value` based on [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) equality, `false` otherwise.

@@ -698,2 +726,31 @@ ```typescript

### notWith
```typescript
function notWith(
fn: unchanged.withHandler,
path: unchanged.Path,
object: unchanged.Unchangeable
): boolean;
```
Returns `false` if the return value of `fn` based on the value returned from `path` in the `object` is equal to `value` based on [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Same-value-zero_equality) equality, `true` otherwise.
```typescript
const object: unchanged.Unchangeable = {
foo: [
{
bar: "baz",
quz: "not baz"
}
]
};
const fn: unchanged.withHandler = (value: any): number =>
value && value.length === 3;
console.log(notWith(fn, "foo[0].bar", object)); // false
console.log(notWith(fn, ["foo", 0, "bar"], object)); // false
console.log(notWith(fn, "foo[0].quz", object)); // true
```
### addWith

@@ -700,0 +757,0 @@

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