New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@domql/utils

Package Overview
Dependencies
Maintainers
3
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@domql/utils - npm Package Compare versions

Comparing version 2.3.89 to 2.3.90

17

array.js
'use strict'
import { isArray, isNumber, isString } from './types'
export const arrayContainsOtherArray = (arr1, arr2) => {
return arr2.every(val => arr1.includes(val))
}
export const removeFromArray = (arr, index) => {
if (isString(index)) index = parseInt(index)
if (isNumber(index)) {
if (index < 0 || index >= arr.length || isNaN(index)) {
throw new Error('Invalid index')
}
arr.splice(index, 1)
} else if (isArray(index)) {
index.forEach(idx => removeFromArray(arr, idx))
} else {
throw new Error('Invalid index')
}
return arr
}

19

dist/cjs/array.js

@@ -21,7 +21,24 @@ "use strict";

__export(array_exports, {
arrayContainsOtherArray: () => arrayContainsOtherArray
arrayContainsOtherArray: () => arrayContainsOtherArray,
removeFromArray: () => removeFromArray
});
module.exports = __toCommonJS(array_exports);
var import_types = require("./types");
const arrayContainsOtherArray = (arr1, arr2) => {
return arr2.every((val) => arr1.includes(val));
};
const removeFromArray = (arr, index) => {
if ((0, import_types.isString)(index))
index = parseInt(index);
if ((0, import_types.isNumber)(index)) {
if (index < 0 || index >= arr.length || isNaN(index)) {
throw new Error("Invalid index");
}
arr.splice(index, 1);
} else if ((0, import_types.isArray)(index)) {
index.forEach((idx) => removeFromArray(arr, idx));
} else {
throw new Error("Invalid index");
}
return arr;
};

@@ -40,3 +40,4 @@ "use strict";

overwriteDeep: () => overwriteDeep,
overwriteObj: () => overwriteObj
overwriteObj: () => overwriteObj,
removeFromObject: () => removeFromObject
});

@@ -327,1 +328,13 @@ module.exports = __toCommonJS(object_exports);

};
const removeFromObject = (obj, props) => {
if (props === void 0 || props === null)
return obj;
if ((0, import_types.is)(props)("string", "number")) {
delete obj[props];
} else if ((0, import_types.isArray)(props)) {
props.forEach((prop) => delete obj[prop]);
} else {
throw new Error("Invalid input: props must be a string or an array of strings");
}
return obj;
};
'use strict'
import { window } from '@domql/globals'
import { isFunction, isObjectLike, isObject, isArray, isString } from './types.js'
import { isFunction, isObjectLike, isObject, isArray, isString, is } from './types.js'

@@ -335,1 +335,13 @@ export const exec = (param, element, state, context) => {

}
export const removeFromObject = (obj, props) => {
if (props === undefined || props === null) return obj
if (is(props)('string', 'number')) {
delete obj[props]
} else if (isArray(props)) {
props.forEach(prop => delete obj[prop])
} else {
throw new Error('Invalid input: props must be a string or an array of strings')
}
return obj
}

4

package.json
{
"name": "@domql/utils",
"version": "2.3.89",
"version": "2.3.90",
"license": "MIT",

@@ -25,3 +25,3 @@ "type": "module",

},
"gitHead": "bb45c7f24e08fb579b72c90abeed9f0054c817b0"
"gitHead": "ab1a0f74fc9a7cc67cd5e732c7a8577d98fbb9b0"
}
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