umt 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module/Object/has.js +3 -2
- package/module/Object/has.js.map +1 -1
- package/module/Object/pick.d.ts +10 -0
- package/module/Object/pick.js +10 -0
- package/module/Object/pick.js.map +1 -1
- package/module/es5/Object/has.js +1 -7
- package/module/es5/Object/pick.d.ts +10 -0
- package/module/es5/Object/pick.js +10 -0
- package/package.json +7 -7
package/module/Object/has.js
CHANGED
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export const has = (object, path) => {
|
|
21
21
|
const localPath = typeof path === "string" ? path.split(".") : path;
|
|
22
|
-
let current =
|
|
22
|
+
let current = object;
|
|
23
23
|
for (const key of localPath) {
|
|
24
|
-
if (current == null ||
|
|
24
|
+
if (current == null ||
|
|
25
|
+
!Object.hasOwn(current, key)) {
|
|
25
26
|
return false;
|
|
26
27
|
}
|
|
27
28
|
current = current[key];
|
package/module/Object/has.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"has.js","sourceRoot":"","sources":["../../src/Object/has.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,MAAS,EACT,IAAuB,EACd,EAAE;IACX,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"has.js","sourceRoot":"","sources":["../../src/Object/has.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,MAAS,EACT,IAAuB,EACd,EAAE;IACX,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,OAAO,GAAY,MAAM,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,IACE,OAAO,IAAI,IAAI;YACf,CAAC,MAAM,CAAC,MAAM,CAAC,OAAkC,EAAE,GAAG,CAAC,EACvD,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,GAAI,OAAmC,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/module/Object/pick.d.ts
CHANGED
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
* @param {...K[]} keys - The property keys to extract.
|
|
8
8
|
* @returns {Pick<T, K>} A new object containing only the specified properties.
|
|
9
9
|
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
12
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
13
|
+
* If processing user-controlled input, sanitize with the appropriate
|
|
14
|
+
* `removePrototype*` helper before calling this function:
|
|
15
|
+
* - `removePrototype` — shallow sanitization of a single object
|
|
16
|
+
* - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
|
|
17
|
+
* - `removePrototypeMap` — shallow sanitization of an array of objects
|
|
18
|
+
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
19
|
+
*
|
|
10
20
|
* @example
|
|
11
21
|
* ```typescript
|
|
12
22
|
* const user = { id: 1, name: 'Alice', age: 30 };
|
package/module/Object/pick.js
CHANGED
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
* @param {...K[]} keys - The property keys to extract.
|
|
8
8
|
* @returns {Pick<T, K>} A new object containing only the specified properties.
|
|
9
9
|
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
12
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
13
|
+
* If processing user-controlled input, sanitize with the appropriate
|
|
14
|
+
* `removePrototype*` helper before calling this function:
|
|
15
|
+
* - `removePrototype` — shallow sanitization of a single object
|
|
16
|
+
* - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
|
|
17
|
+
* - `removePrototypeMap` — shallow sanitization of an array of objects
|
|
18
|
+
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
19
|
+
*
|
|
10
20
|
* @example
|
|
11
21
|
* ```typescript
|
|
12
22
|
* const user = { id: 1, name: 'Alice', age: 30 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../src/Object/pick.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pick.js","sourceRoot":"","sources":["../../src/Object/pick.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,MAAS,EACT,GAAG,IAAS,EACA,EAAE;IACd,MAAM,MAAM,GAAG,EAAgB,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/module/es5/Object/has.js
CHANGED
|
@@ -4,15 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.has = void 0;
|
|
7
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
7
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
9
8
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
9
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
10
|
/**
|
|
17
11
|
* Determines if an object has a specified path
|
|
18
12
|
* @param {T} object - Object to check
|
|
@@ -34,7 +28,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
34
28
|
*/
|
|
35
29
|
var has = exports.has = function has(object, path) {
|
|
36
30
|
var localPath = typeof path === "string" ? path.split(".") : path;
|
|
37
|
-
var current =
|
|
31
|
+
var current = object;
|
|
38
32
|
var _iterator = _createForOfIteratorHelper(localPath),
|
|
39
33
|
_step;
|
|
40
34
|
try {
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
* @param {...K[]} keys - The property keys to extract.
|
|
8
8
|
* @returns {Pick<T, K>} A new object containing only the specified properties.
|
|
9
9
|
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
12
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
13
|
+
* If processing user-controlled input, sanitize with the appropriate
|
|
14
|
+
* `removePrototype*` helper before calling this function:
|
|
15
|
+
* - `removePrototype` — shallow sanitization of a single object
|
|
16
|
+
* - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
|
|
17
|
+
* - `removePrototypeMap` — shallow sanitization of an array of objects
|
|
18
|
+
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
19
|
+
*
|
|
10
20
|
* @example
|
|
11
21
|
* ```typescript
|
|
12
22
|
* const user = { id: 1, name: 'Alice', age: 30 };
|
|
@@ -13,6 +13,16 @@ exports.pick = void 0;
|
|
|
13
13
|
* @param {...K[]} keys - The property keys to extract.
|
|
14
14
|
* @returns {Pick<T, K>} A new object containing only the specified properties.
|
|
15
15
|
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* **Prototype pollution warning:** This function does not filter out
|
|
18
|
+
* prototype-polluting keys (`__proto__`, `constructor`, `prototype`).
|
|
19
|
+
* If processing user-controlled input, sanitize with the appropriate
|
|
20
|
+
* `removePrototype*` helper before calling this function:
|
|
21
|
+
* - `removePrototype` — shallow sanitization of a single object
|
|
22
|
+
* - `removePrototypeDeep` — recursive sanitization of a single object (for deeply nested data)
|
|
23
|
+
* - `removePrototypeMap` — shallow sanitization of an array of objects
|
|
24
|
+
* - `removePrototypeMapDeep` — recursive sanitization of an array of objects (for deeply nested data)
|
|
25
|
+
*
|
|
16
26
|
* @example
|
|
17
27
|
* ```typescript
|
|
18
28
|
* const user = { id: 1, name: 'Alice', age: 30 };
|
package/package.json
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"@babel/core": "7.29.0",
|
|
10
10
|
"@babel/preset-env": "7.29.2",
|
|
11
11
|
"@babel/preset-typescript": "7.28.5",
|
|
12
|
-
"@biomejs/biome": "2.4.
|
|
13
|
-
"@codecov/bundle-analyzer": "
|
|
12
|
+
"@biomejs/biome": "2.4.12",
|
|
13
|
+
"@codecov/bundle-analyzer": "2.0.1",
|
|
14
14
|
"@eslint/js": "10.0.1",
|
|
15
|
-
"@swc/core": "1.15.
|
|
15
|
+
"@swc/core": "1.15.30",
|
|
16
16
|
"@swc/jest": "0.2.39",
|
|
17
17
|
"@types/bun": "1.3.12",
|
|
18
18
|
"@types/jest": "30.0.0",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"bun-types": "1.3.12",
|
|
24
24
|
"dependency-cruiser": "17.3.10",
|
|
25
25
|
"es-toolkit": "1.45.1",
|
|
26
|
-
"eslint": "10.2.
|
|
27
|
-
"eslint-plugin-baseline-js": "0.6.
|
|
26
|
+
"eslint": "10.2.1",
|
|
27
|
+
"eslint-plugin-baseline-js": "0.6.2",
|
|
28
28
|
"eslint-plugin-import": "2.32.0",
|
|
29
29
|
"eslint-plugin-unicorn": "64.0.0",
|
|
30
30
|
"fast-sort": "3.4.1",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"ts-node": "10.9.2",
|
|
38
38
|
"tsc-alias": "1.8.16",
|
|
39
39
|
"typedoc": "0.28.19",
|
|
40
|
-
"typescript": "6.0.
|
|
40
|
+
"typescript": "6.0.3",
|
|
41
41
|
"typescript-eslint": "8.58.2"
|
|
42
42
|
},
|
|
43
43
|
"exports": {
|
|
@@ -218,5 +218,5 @@
|
|
|
218
218
|
},
|
|
219
219
|
"type": "module",
|
|
220
220
|
"types": "module/index.d.ts",
|
|
221
|
-
"version": "2.
|
|
221
|
+
"version": "2.16.0"
|
|
222
222
|
}
|