Socket
Socket
Sign inDemoInstall

@domql/utils

Package Overview
Dependencies
Maintainers
0
Versions
168
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.5.97 to 2.5.100

33

dist/cjs/object.js

@@ -21,2 +21,3 @@ "use strict";

__export(object_exports, {
checkIfKeyIsComponent: () => checkIfKeyIsComponent,
clone: () => clone,

@@ -37,2 +38,3 @@ createObjectWithoutPrototype: () => createObjectWithoutPrototype,

exec: () => exec,
findExtendsInElement: () => findExtendsInElement,
flattenRecursive: () => flattenRecursive,

@@ -520,1 +522,32 @@ hasOwnProperty: () => hasOwnProperty,

};
const checkIfKeyIsComponent = (key) => {
const isFirstKeyString = (0, import_types.isString)(key);
if (!isFirstKeyString)
return;
const firstCharKey = key.slice(0, 1);
return /^[A-Z]*$/.test(firstCharKey);
};
const findExtendsInElement = (obj) => {
let result = [];
function traverse(o) {
for (const key in o) {
if (Object.hasOwnProperty.call(o, key)) {
if (checkIfKeyIsComponent(key)) {
result.push(key);
}
if (key === "extend") {
if (typeof o[key] === "string") {
result.push(o[key]);
} else if (Array.isArray(o[key])) {
result = result.concat(o[key]);
}
}
if (typeof o[key] === "object" && o[key] !== null) {
traverse(o[key]);
}
}
}
}
traverse(obj);
return result;
};

@@ -21,2 +21,4 @@ "use strict";

__export(string_exports, {
customDecodeURIComponent: () => customDecodeURIComponent,
customEncodeURIComponent: () => customEncodeURIComponent,
findKeyPosition: () => findKeyPosition,

@@ -125,1 +127,12 @@ lowercaseFirstLetter: () => lowercaseFirstLetter,

};
const customEncodeURIComponent = (str) => {
return str.split("").map((char) => {
if (/[^a-zA-Z0-9\s]/.test(char)) {
return "%" + char.charCodeAt(0).toString(16).toUpperCase();
}
return char;
}).join("");
};
const customDecodeURIComponent = (encodedStr) => {
return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, (match) => String.fromCharCode(parseInt(match.slice(1), 16)));
};

@@ -596,1 +596,41 @@ 'use strict'

}
export const checkIfKeyIsComponent = (key) => {
const isFirstKeyString = isString(key)
if (!isFirstKeyString) return
const firstCharKey = key.slice(0, 1)
return /^[A-Z]*$/.test(firstCharKey)
}
export const findExtendsInElement = (obj) => {
let result = []
function traverse (o) {
for (const key in o) {
if (Object.hasOwnProperty.call(o, key)) {
// Check if the key starts with a capital letter and exclude keys like @mobileL, $propsCollection
if (checkIfKeyIsComponent(key)) {
result.push(key)
}
// Check if the key is "extend" and it's either a string or an array
if (key === 'extend') {
// Add the value of the extend key to the result array
if (typeof o[key] === 'string') {
result.push(o[key])
} else if (Array.isArray(o[key])) {
result = result.concat(o[key])
}
}
// If the property is an object, traverse it
if (typeof o[key] === 'object' && o[key] !== null) {
traverse(o[key])
}
}
}
}
traverse(obj)
return result
}

4

package.json
{
"name": "@domql/utils",
"version": "2.5.97",
"version": "2.5.100",
"license": "MIT",

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

},
"gitHead": "0dd6029804289092faf4f94a4b853486233baf34",
"gitHead": "38b74a597edc2f9454a81b892505282a944fd5b9",
"devDependencies": {

@@ -29,0 +29,0 @@ "@babel/core": "^7.12.0"

@@ -127,1 +127,14 @@ 'use strict'

}
export const customEncodeURIComponent = (str) => {
return str.split('').map(char => {
if (/[^a-zA-Z0-9\s]/.test(char)) {
return '%' + char.charCodeAt(0).toString(16).toUpperCase()
}
return char
}).join('')
}
export const customDecodeURIComponent = (encodedStr) => {
return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, match => String.fromCharCode(parseInt(match.slice(1), 16)))
}
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