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

noyb

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noyb - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

9

dist/noyb.js

@@ -68,8 +68,9 @@ (function (global, factory) {

* objects are equal
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Function} comparator A custom function to compare values.
* @return {Boolean} Result is true if the two objects are equal.
*/
var deepCompare = function deepCompare(objA, objB) {
var deepCompare = function deepCompare(objA, objB, comparator) {
var typeA = getType(objA);

@@ -86,3 +87,3 @@ var typeB = getType(objB);

if (!deepCompare(valueA, valueB)) {
if (!(comparator != null ? comparator : deepCompare)(valueA, valueB)) {
return false;

@@ -89,0 +90,0 @@ }

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

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["Object Helpers"]={})}(this,(function(e){"use strict";function r(){return(r=Object.assign||function(e){for(var r=1;arguments.length>r;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var t=function(e){return Object.prototype.toString.call(e).toLowerCase().replace(/\[object\s|\]/g,"")},n=function e(n,o,c){void 0===c&&(c=!1);var i=t(n),a=(arguments.length>3?arguments.length-3:0)>0,u=arguments.length>3?arguments[3]:void 0;if("array"!==i&&"object"!==i)return n;var f=n;if(c||("array"===i&&(f=[].concat(n)),"object"===i&&(f=r({},n))),""===o)return a?f:void 0;if("*"===o){if(a){if("array"===i)if(void 0===u)for(;f.length;)e(f,0,!0,u);else{var l=f,v=l.length;f.forEach((function(r,n){var o=v-1-n,i=u;if("function"===t(u)&&(i=u(f[o])),void 0===i)e(f,o,!0,void 0);else{var a=e(f,o,c,i);f[o]=a[o]}}))}else"object"===i&&Object.keys(f).forEach((function(r){return e(f,r,!0,u)}));return f}if("array"===i)return f;if("object"===i)return Object.values(f)}if(a){var d=u;return"function"===t(d)&&(d=d(f[o])),void 0===d&&"array"===i?f.splice(o,1):void 0===d&&"object"===i?delete f[o]:f[o]=d,f}return f[o]},o=function e(o,c,i){void 0===i&&(i=!1);var a=t(o),u=(arguments.length>3?arguments.length-3:0)>0,f=arguments.length>3?arguments[3]:void 0,l=(""+c).replace(/^\[|\]$/g,"");if(1===(l=(l=(l=l.replace(/\[|\]/g,".")).replace(/\.{2,}/g,".")).split(".")).length)return u?n(o,l[0],i,f):n(o,l[0],i);var v=o;i||("array"===a&&(v=[].concat(o)),"object"===a&&(v=r({},o)));var d=l[0],s=l.slice(1).join(".");if(u)return"*"===d?("array"===a&&v.forEach((function(r,t){v[t]=e(r,s,i,f)})),"object"===a&&Object.keys(v).forEach((function(r){v[r]=e(v[r],s,i,f)})),v):(void 0===v[d]&&(v[d]={}),v[d]=e(v[d],s,i,f),v);if("*"===d){if("array"===a)return v.map((function(r){return e(r,s,i)}));if("object"===a)return Object.values(v).map((function(r){return e(r,s,i)}))}return e(v[d]||{},s,i)};e.applyDefaults=function e(n,o){return void 0===n&&(n={}),void 0===o&&(o={}),Object.keys(r({},n,o)).reduce((function(c,i){var a,u;return u="object"===t(o[i])?e(n[i],o[i]):"undefined"!==t(n[i])?n[i]:o[i],r({},c,((a={})[i]=u,a))}),{})},e.deepCompare=function e(r,n){var o=t(r);if(o!==t(n))return!1;if("object"===o||"array"===o)for(var c=Object.keys(r),i=0;c.length>i;i+=1){if(!e(r[c[i]],n[c[i]]))return!1}return(null==r?void 0:""+r)===(null==n?void 0:""+n)},e.deepCopy=function e(r){var n=t(r);if("object"===n||"array"===n){var o="array"===n?[]:{};return Object.keys(r).forEach((function(n){o[n]=["object","array"].includes(t(r[n]))?e(r[n]):r[n]})),o}return r},e.getType=t,e.mergeObjects=function(e,t){return Object.keys(t).reduce((function(e,r){return o(e,r,!1,t[r])}),r({},e))},e.queryObject=function(e,n){for(var c=arguments.length,i=Array(c>2?c-2:0),a=2;c>a;a++)i[a-2]=arguments[a];return"string"===t(e)?o.apply(void 0,[n,e,!1].concat(i)):"object"===t(e)?Object.keys(e).reduce((function(t,c){var a;return r({},t,((a={})[c]=o.apply(void 0,[n,e[c],!1].concat(i)),a))}),{}):n},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["Object Helpers"]={})}(this,(function(e){"use strict";function r(){return(r=Object.assign||function(e){for(var r=1;arguments.length>r;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}var t=function(e){return Object.prototype.toString.call(e).toLowerCase().replace(/\[object\s|\]/g,"")},n=function e(n,o,c){void 0===c&&(c=!1);var i=t(n),a=(arguments.length>3?arguments.length-3:0)>0,u=arguments.length>3?arguments[3]:void 0;if("array"!==i&&"object"!==i)return n;var f=n;if(c||("array"===i&&(f=[].concat(n)),"object"===i&&(f=r({},n))),""===o)return a?f:void 0;if("*"===o){if(a){if("array"===i)if(void 0===u)for(;f.length;)e(f,0,!0,u);else{var l=f,v=l.length;f.forEach((function(r,n){var o=v-1-n,i=u;if("function"===t(u)&&(i=u(f[o])),void 0===i)e(f,o,!0,void 0);else{var a=e(f,o,c,i);f[o]=a[o]}}))}else"object"===i&&Object.keys(f).forEach((function(r){return e(f,r,!0,u)}));return f}if("array"===i)return f;if("object"===i)return Object.values(f)}if(a){var d=u;return"function"===t(d)&&(d=d(f[o])),void 0===d&&"array"===i?f.splice(o,1):void 0===d&&"object"===i?delete f[o]:f[o]=d,f}return f[o]},o=function e(o,c,i){void 0===i&&(i=!1);var a=t(o),u=(arguments.length>3?arguments.length-3:0)>0,f=arguments.length>3?arguments[3]:void 0,l=(""+c).replace(/^\[|\]$/g,"");if(1===(l=(l=(l=l.replace(/\[|\]/g,".")).replace(/\.{2,}/g,".")).split(".")).length)return u?n(o,l[0],i,f):n(o,l[0],i);var v=o;i||("array"===a&&(v=[].concat(o)),"object"===a&&(v=r({},o)));var d=l[0],s=l.slice(1).join(".");if(u)return"*"===d?("array"===a&&v.forEach((function(r,t){v[t]=e(r,s,i,f)})),"object"===a&&Object.keys(v).forEach((function(r){v[r]=e(v[r],s,i,f)})),v):(void 0===v[d]&&(v[d]={}),v[d]=e(v[d],s,i,f),v);if("*"===d){if("array"===a)return v.map((function(r){return e(r,s,i)}));if("object"===a)return Object.values(v).map((function(r){return e(r,s,i)}))}return e(v[d]||{},s,i)};e.applyDefaults=function e(n,o){return void 0===n&&(n={}),void 0===o&&(o={}),Object.keys(r({},n,o)).reduce((function(c,i){var a,u;return u="object"===t(o[i])?e(n[i],o[i]):"undefined"!==t(n[i])?n[i]:o[i],r({},c,((a={})[i]=u,a))}),{})},e.deepCompare=function e(r,n,o){var c=t(r);if(c!==t(n))return!1;if("object"===c||"array"===c)for(var i=Object.keys(r),a=0;i.length>a;a+=1){if(!(null!=o?o:e)(r[i[a]],n[i[a]]))return!1}return(null==r?void 0:""+r)===(null==n?void 0:""+n)},e.deepCopy=function e(r){var n=t(r);if("object"===n||"array"===n){var o="array"===n?[]:{};return Object.keys(r).forEach((function(n){o[n]=["object","array"].includes(t(r[n]))?e(r[n]):r[n]})),o}return r},e.getType=t,e.mergeObjects=function(e,t){return Object.keys(t).reduce((function(e,r){return o(e,r,!1,t[r])}),r({},e))},e.queryObject=function(e,n){for(var c=arguments.length,i=Array(c>2?c-2:0),a=2;c>a;a++)i[a-2]=arguments[a];return"string"===t(e)?o.apply(void 0,[n,e,!1].concat(i)):"object"===t(e)?Object.keys(e).reduce((function(t,c){var a;return r({},t,((a={})[c]=o.apply(void 0,[n,e[c],!1].concat(i)),a))}),{}):n},Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -5,8 +5,9 @@ import getType from './get-type';

* objects are equal
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Function} comparator A custom function to compare values.
* @return {Boolean} Result is true if the two objects are equal.
*/
var deepCompare = function deepCompare(objA, objB) {
var deepCompare = function deepCompare(objA, objB, comparator) {
var typeA = getType(objA);

@@ -23,3 +24,3 @@ var typeB = getType(objB);

if (!deepCompare(valueA, valueB)) {
if (!(comparator != null ? comparator : deepCompare)(valueA, valueB)) {
return false;

@@ -26,0 +27,0 @@ }

@@ -13,7 +13,8 @@ "use strict";

* objects are equal
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Function} comparator A custom function to compare values.
* @return {Boolean} Result is true if the two objects are equal.
*/
var deepCompare = function deepCompare(objA, objB) {
var deepCompare = function deepCompare(objA, objB, comparator) {
var typeA = (0, _getType["default"])(objA);

@@ -30,3 +31,3 @@ var typeB = (0, _getType["default"])(objB);

if (!deepCompare(valueA, valueB)) {
if (!(comparator != null ? comparator : deepCompare)(valueA, valueB)) {
return false;

@@ -33,0 +34,0 @@ }

{
"name": "noyb",
"version": "0.1.5",
"version": "0.1.6",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -6,7 +6,8 @@ import getType from './get-type';

* objects are equal
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Object | Array} objA First object.
* @param {Object | Array} objB Second object.
* @param {Function} comparator A custom function to compare values.
* @return {Boolean} Result is true if the two objects are equal.
*/
const deepCompare = (objA, objB) => {
const deepCompare = (objA, objB, comparator) => {
const typeA = getType(objA);

@@ -24,3 +25,3 @@ const typeB = getType(objB);

if (!deepCompare(valueA, valueB)) {
if (!(comparator ?? deepCompare)(valueA, valueB)) {
return false;

@@ -27,0 +28,0 @@ }

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