langsmith 0.5.17 → 0.5.18
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/dist/anonymizer/index.cjs +46 -20
- package/dist/anonymizer/index.js +46 -17
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/utils/lodash/assignValue.cjs +0 -29
- package/dist/utils/lodash/assignValue.d.ts +0 -10
- package/dist/utils/lodash/assignValue.js +0 -24
- package/dist/utils/lodash/baseAssignValue.cjs +0 -25
- package/dist/utils/lodash/baseAssignValue.d.ts +0 -11
- package/dist/utils/lodash/baseAssignValue.js +0 -23
- package/dist/utils/lodash/baseSet.cjs +0 -50
- package/dist/utils/lodash/baseSet.d.ts +0 -12
- package/dist/utils/lodash/baseSet.js +0 -45
- package/dist/utils/lodash/castPath.cjs +0 -22
- package/dist/utils/lodash/castPath.d.ts +0 -10
- package/dist/utils/lodash/castPath.js +0 -17
- package/dist/utils/lodash/eq.cjs +0 -36
- package/dist/utils/lodash/eq.d.ts +0 -32
- package/dist/utils/lodash/eq.js +0 -34
- package/dist/utils/lodash/getTag.cjs +0 -18
- package/dist/utils/lodash/getTag.d.ts +0 -9
- package/dist/utils/lodash/getTag.js +0 -16
- package/dist/utils/lodash/isIndex.cjs +0 -25
- package/dist/utils/lodash/isIndex.d.ts +0 -10
- package/dist/utils/lodash/isIndex.js +0 -23
- package/dist/utils/lodash/isKey.cjs +0 -34
- package/dist/utils/lodash/isKey.d.ts +0 -10
- package/dist/utils/lodash/isKey.js +0 -29
- package/dist/utils/lodash/isObject.cjs +0 -31
- package/dist/utils/lodash/isObject.d.ts +0 -25
- package/dist/utils/lodash/isObject.js +0 -29
- package/dist/utils/lodash/isSymbol.cjs +0 -28
- package/dist/utils/lodash/isSymbol.d.ts +0 -17
- package/dist/utils/lodash/isSymbol.js +0 -23
- package/dist/utils/lodash/memoizeCapped.cjs +0 -65
- package/dist/utils/lodash/memoizeCapped.d.ts +0 -50
- package/dist/utils/lodash/memoizeCapped.js +0 -63
- package/dist/utils/lodash/set.cjs +0 -41
- package/dist/utils/lodash/set.d.ts +0 -32
- package/dist/utils/lodash/set.js +0 -36
- package/dist/utils/lodash/stringToPath.cjs +0 -49
- package/dist/utils/lodash/stringToPath.d.ts +0 -12
- package/dist/utils/lodash/stringToPath.js +0 -44
- package/dist/utils/lodash/toKey.cjs +0 -24
- package/dist/utils/lodash/toKey.d.ts +0 -9
- package/dist/utils/lodash/toKey.js +0 -19
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createAnonymizer = createAnonymizer;
|
|
7
|
-
const set_js_1 = __importDefault(require("../utils/lodash/set.cjs"));
|
|
8
4
|
function extractStringNodes(data, options) {
|
|
9
5
|
const parsedOptions = { ...options, maxDepth: options.maxDepth ?? 10 };
|
|
10
|
-
const queue = [
|
|
11
|
-
|
|
12
|
-
];
|
|
6
|
+
const queue = [[data, 0, "", null, ""]];
|
|
7
|
+
let nextId = 0;
|
|
13
8
|
const result = [];
|
|
14
9
|
while (queue.length > 0) {
|
|
15
10
|
const task = queue.shift();
|
|
16
11
|
if (task == null)
|
|
17
12
|
continue;
|
|
18
|
-
const [value, depth, path] = task;
|
|
19
|
-
if (typeof value === "
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const [value, depth, path, parent, key] = task;
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
result.push({
|
|
16
|
+
value,
|
|
17
|
+
path,
|
|
18
|
+
parent: parent,
|
|
19
|
+
key,
|
|
20
|
+
_id: nextId++,
|
|
21
|
+
});
|
|
25
22
|
}
|
|
26
23
|
else if (Array.isArray(value)) {
|
|
27
24
|
if (depth >= parsedOptions.maxDepth)
|
|
28
25
|
continue;
|
|
29
26
|
for (let i = 0; i < value.length; i++) {
|
|
30
|
-
queue.push([
|
|
27
|
+
queue.push([
|
|
28
|
+
value[i],
|
|
29
|
+
depth + 1,
|
|
30
|
+
`${path}[${i}]`,
|
|
31
|
+
value,
|
|
32
|
+
String(i),
|
|
33
|
+
]);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
else if (typeof value === "
|
|
34
|
-
|
|
36
|
+
else if (typeof value === "object" && value != null) {
|
|
37
|
+
if (depth >= parsedOptions.maxDepth)
|
|
38
|
+
continue;
|
|
39
|
+
for (const [k, nestedValue] of Object.entries(value)) {
|
|
40
|
+
queue.push([
|
|
41
|
+
nestedValue,
|
|
42
|
+
depth + 1,
|
|
43
|
+
path ? `${path}.${k}` : k,
|
|
44
|
+
value,
|
|
45
|
+
k,
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
35
48
|
}
|
|
36
49
|
}
|
|
37
50
|
return result;
|
|
@@ -69,7 +82,7 @@ function createAnonymizer(replacer, options) {
|
|
|
69
82
|
return result;
|
|
70
83
|
}, item.value);
|
|
71
84
|
if (newValue !== item.value) {
|
|
72
|
-
memo.push({ value: newValue
|
|
85
|
+
memo.push({ ...item, value: newValue });
|
|
73
86
|
}
|
|
74
87
|
return memo;
|
|
75
88
|
}, []);
|
|
@@ -81,19 +94,32 @@ function createAnonymizer(replacer, options) {
|
|
|
81
94
|
maskNodes: (nodes) => nodes.reduce((memo, item) => {
|
|
82
95
|
const newValue = replacer(item.value, item.path);
|
|
83
96
|
if (newValue !== item.value) {
|
|
84
|
-
memo.push({ value: newValue
|
|
97
|
+
memo.push({ ...item, value: newValue });
|
|
85
98
|
}
|
|
86
99
|
return memo;
|
|
87
100
|
}, []),
|
|
88
101
|
}
|
|
89
102
|
: replacer;
|
|
103
|
+
// Build a lookup from _id to internal node for direct write-back.
|
|
104
|
+
const nodesById = new Map();
|
|
105
|
+
for (const node of nodes) {
|
|
106
|
+
nodesById.set(node._id, node);
|
|
107
|
+
}
|
|
90
108
|
const toUpdate = processor.maskNodes(nodes);
|
|
91
109
|
for (const node of toUpdate) {
|
|
92
110
|
if (node.path === "") {
|
|
93
111
|
mutateValue = node.value;
|
|
94
112
|
}
|
|
95
113
|
else {
|
|
96
|
-
|
|
114
|
+
// Match by _id if available (built-in replacers propagate it from
|
|
115
|
+
// the input nodes), otherwise fall back to path matching.
|
|
116
|
+
const asInternal = node;
|
|
117
|
+
const internal = asInternal._id !== undefined
|
|
118
|
+
? nodesById.get(asInternal._id)
|
|
119
|
+
: nodes.find((n) => n.path === node.path);
|
|
120
|
+
if (internal) {
|
|
121
|
+
internal.parent[internal.key] = node.value;
|
|
122
|
+
}
|
|
97
123
|
}
|
|
98
124
|
}
|
|
99
125
|
return mutateValue;
|
package/dist/anonymizer/index.js
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
|
-
import set from "../utils/lodash/set.js";
|
|
2
1
|
function extractStringNodes(data, options) {
|
|
3
2
|
const parsedOptions = { ...options, maxDepth: options.maxDepth ?? 10 };
|
|
4
|
-
const queue = [
|
|
5
|
-
|
|
6
|
-
];
|
|
3
|
+
const queue = [[data, 0, "", null, ""]];
|
|
4
|
+
let nextId = 0;
|
|
7
5
|
const result = [];
|
|
8
6
|
while (queue.length > 0) {
|
|
9
7
|
const task = queue.shift();
|
|
10
8
|
if (task == null)
|
|
11
9
|
continue;
|
|
12
|
-
const [value, depth, path] = task;
|
|
13
|
-
if (typeof value === "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const [value, depth, path, parent, key] = task;
|
|
11
|
+
if (typeof value === "string") {
|
|
12
|
+
result.push({
|
|
13
|
+
value,
|
|
14
|
+
path,
|
|
15
|
+
parent: parent,
|
|
16
|
+
key,
|
|
17
|
+
_id: nextId++,
|
|
18
|
+
});
|
|
19
19
|
}
|
|
20
20
|
else if (Array.isArray(value)) {
|
|
21
21
|
if (depth >= parsedOptions.maxDepth)
|
|
22
22
|
continue;
|
|
23
23
|
for (let i = 0; i < value.length; i++) {
|
|
24
|
-
queue.push([
|
|
24
|
+
queue.push([
|
|
25
|
+
value[i],
|
|
26
|
+
depth + 1,
|
|
27
|
+
`${path}[${i}]`,
|
|
28
|
+
value,
|
|
29
|
+
String(i),
|
|
30
|
+
]);
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
|
-
else if (typeof value === "
|
|
28
|
-
|
|
33
|
+
else if (typeof value === "object" && value != null) {
|
|
34
|
+
if (depth >= parsedOptions.maxDepth)
|
|
35
|
+
continue;
|
|
36
|
+
for (const [k, nestedValue] of Object.entries(value)) {
|
|
37
|
+
queue.push([
|
|
38
|
+
nestedValue,
|
|
39
|
+
depth + 1,
|
|
40
|
+
path ? `${path}.${k}` : k,
|
|
41
|
+
value,
|
|
42
|
+
k,
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
29
45
|
}
|
|
30
46
|
}
|
|
31
47
|
return result;
|
|
@@ -63,7 +79,7 @@ export function createAnonymizer(replacer, options) {
|
|
|
63
79
|
return result;
|
|
64
80
|
}, item.value);
|
|
65
81
|
if (newValue !== item.value) {
|
|
66
|
-
memo.push({ value: newValue
|
|
82
|
+
memo.push({ ...item, value: newValue });
|
|
67
83
|
}
|
|
68
84
|
return memo;
|
|
69
85
|
}, []);
|
|
@@ -75,19 +91,32 @@ export function createAnonymizer(replacer, options) {
|
|
|
75
91
|
maskNodes: (nodes) => nodes.reduce((memo, item) => {
|
|
76
92
|
const newValue = replacer(item.value, item.path);
|
|
77
93
|
if (newValue !== item.value) {
|
|
78
|
-
memo.push({ value: newValue
|
|
94
|
+
memo.push({ ...item, value: newValue });
|
|
79
95
|
}
|
|
80
96
|
return memo;
|
|
81
97
|
}, []),
|
|
82
98
|
}
|
|
83
99
|
: replacer;
|
|
100
|
+
// Build a lookup from _id to internal node for direct write-back.
|
|
101
|
+
const nodesById = new Map();
|
|
102
|
+
for (const node of nodes) {
|
|
103
|
+
nodesById.set(node._id, node);
|
|
104
|
+
}
|
|
84
105
|
const toUpdate = processor.maskNodes(nodes);
|
|
85
106
|
for (const node of toUpdate) {
|
|
86
107
|
if (node.path === "") {
|
|
87
108
|
mutateValue = node.value;
|
|
88
109
|
}
|
|
89
110
|
else {
|
|
90
|
-
|
|
111
|
+
// Match by _id if available (built-in replacers propagate it from
|
|
112
|
+
// the input nodes), otherwise fall back to path matching.
|
|
113
|
+
const asInternal = node;
|
|
114
|
+
const internal = asInternal._id !== undefined
|
|
115
|
+
? nodesById.get(asInternal._id)
|
|
116
|
+
: nodes.find((n) => n.path === node.path);
|
|
117
|
+
if (internal) {
|
|
118
|
+
internal.parent[internal.key] = node.value;
|
|
119
|
+
}
|
|
91
120
|
}
|
|
92
121
|
}
|
|
93
122
|
return mutateValue;
|
package/dist/index.cjs
CHANGED
|
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
|
|
|
18
18
|
Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
|
|
19
19
|
Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
|
|
20
20
|
// Update using pnpm bump-version
|
|
21
|
-
exports.__version__ = "0.5.
|
|
21
|
+
exports.__version__ = "0.5.18";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
|
5
5
|
export { getDefaultProjectName } from "./utils/project.js";
|
|
6
6
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
7
7
|
export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
|
-
export declare const __version__ = "0.5.
|
|
8
|
+
export declare const __version__ = "0.5.18";
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
7
7
|
// Update using pnpm bump-version
|
|
8
|
-
export const __version__ = "0.5.
|
|
8
|
+
export const __version__ = "0.5.18";
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const baseAssignValue_js_1 = __importDefault(require("./baseAssignValue.cjs"));
|
|
7
|
-
const eq_js_1 = __importDefault(require("./eq.cjs"));
|
|
8
|
-
/** Used to check objects for own properties. */
|
|
9
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
10
|
-
/**
|
|
11
|
-
* Assigns `value` to `key` of `object` if the existing value is not equivalent.
|
|
12
|
-
*
|
|
13
|
-
* @private
|
|
14
|
-
* @param {Object} object The object to modify.
|
|
15
|
-
* @param {string} key The key of the property to assign.
|
|
16
|
-
* @param {*} value The value to assign.
|
|
17
|
-
*/
|
|
18
|
-
function assignValue(object, key, value) {
|
|
19
|
-
const objValue = object[key];
|
|
20
|
-
if (!(hasOwnProperty.call(object, key) && (0, eq_js_1.default)(objValue, value))) {
|
|
21
|
-
if (value !== 0 || 1 / value === 1 / objValue) {
|
|
22
|
-
(0, baseAssignValue_js_1.default)(object, key, value);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else if (value === undefined && !(key in object)) {
|
|
26
|
-
(0, baseAssignValue_js_1.default)(object, key, value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.default = assignValue;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Assigns `value` to `key` of `object` if the existing value is not equivalent.
|
|
3
|
-
*
|
|
4
|
-
* @private
|
|
5
|
-
* @param {Object} object The object to modify.
|
|
6
|
-
* @param {string} key The key of the property to assign.
|
|
7
|
-
* @param {*} value The value to assign.
|
|
8
|
-
*/
|
|
9
|
-
declare function assignValue(object: Record<string, any>, key: string, value: any): void;
|
|
10
|
-
export default assignValue;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import baseAssignValue from "./baseAssignValue.js";
|
|
2
|
-
import eq from "./eq.js";
|
|
3
|
-
/** Used to check objects for own properties. */
|
|
4
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
5
|
-
/**
|
|
6
|
-
* Assigns `value` to `key` of `object` if the existing value is not equivalent.
|
|
7
|
-
*
|
|
8
|
-
* @private
|
|
9
|
-
* @param {Object} object The object to modify.
|
|
10
|
-
* @param {string} key The key of the property to assign.
|
|
11
|
-
* @param {*} value The value to assign.
|
|
12
|
-
*/
|
|
13
|
-
function assignValue(object, key, value) {
|
|
14
|
-
const objValue = object[key];
|
|
15
|
-
if (!(hasOwnProperty.call(object, key) && eq(objValue, value))) {
|
|
16
|
-
if (value !== 0 || 1 / value === 1 / objValue) {
|
|
17
|
-
baseAssignValue(object, key, value);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else if (value === undefined && !(key in object)) {
|
|
21
|
-
baseAssignValue(object, key, value);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export default assignValue;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
5
|
-
* value checks.
|
|
6
|
-
*
|
|
7
|
-
* @private
|
|
8
|
-
* @param {Object} object The object to modify.
|
|
9
|
-
* @param {string} key The key of the property to assign.
|
|
10
|
-
* @param {*} value The value to assign.
|
|
11
|
-
*/
|
|
12
|
-
function baseAssignValue(object, key, value) {
|
|
13
|
-
if (key === "__proto__") {
|
|
14
|
-
Object.defineProperty(object, key, {
|
|
15
|
-
configurable: true,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
value: value,
|
|
18
|
-
writable: true,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
object[key] = value;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.default = baseAssignValue;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
3
|
-
* value checks.
|
|
4
|
-
*
|
|
5
|
-
* @private
|
|
6
|
-
* @param {Object} object The object to modify.
|
|
7
|
-
* @param {string} key The key of the property to assign.
|
|
8
|
-
* @param {*} value The value to assign.
|
|
9
|
-
*/
|
|
10
|
-
declare function baseAssignValue(object: Record<string, any>, key: string, value: any): void;
|
|
11
|
-
export default baseAssignValue;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
3
|
-
* value checks.
|
|
4
|
-
*
|
|
5
|
-
* @private
|
|
6
|
-
* @param {Object} object The object to modify.
|
|
7
|
-
* @param {string} key The key of the property to assign.
|
|
8
|
-
* @param {*} value The value to assign.
|
|
9
|
-
*/
|
|
10
|
-
function baseAssignValue(object, key, value) {
|
|
11
|
-
if (key === "__proto__") {
|
|
12
|
-
Object.defineProperty(object, key, {
|
|
13
|
-
configurable: true,
|
|
14
|
-
enumerable: true,
|
|
15
|
-
value: value,
|
|
16
|
-
writable: true,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
object[key] = value;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export default baseAssignValue;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const assignValue_js_1 = __importDefault(require("./assignValue.cjs"));
|
|
8
|
-
const castPath_js_1 = __importDefault(require("./castPath.cjs"));
|
|
9
|
-
const isIndex_js_1 = __importDefault(require("./isIndex.cjs"));
|
|
10
|
-
const isObject_js_1 = __importDefault(require("./isObject.cjs"));
|
|
11
|
-
const toKey_js_1 = __importDefault(require("./toKey.cjs"));
|
|
12
|
-
/**
|
|
13
|
-
* The base implementation of `set`.
|
|
14
|
-
*
|
|
15
|
-
* @private
|
|
16
|
-
* @param {Object} object The object to modify.
|
|
17
|
-
* @param {Array|string} path The path of the property to set.
|
|
18
|
-
* @param {*} value The value to set.
|
|
19
|
-
* @param {Function} [customizer] The function to customize path creation.
|
|
20
|
-
* @returns {Object} Returns `object`.
|
|
21
|
-
*/
|
|
22
|
-
function baseSet(object, path, value, customizer) {
|
|
23
|
-
if (!(0, isObject_js_1.default)(object)) {
|
|
24
|
-
return object;
|
|
25
|
-
}
|
|
26
|
-
path = (0, castPath_js_1.default)(path, object);
|
|
27
|
-
const length = path.length;
|
|
28
|
-
const lastIndex = length - 1;
|
|
29
|
-
let index = -1;
|
|
30
|
-
let nested = object;
|
|
31
|
-
while (nested != null && ++index < length) {
|
|
32
|
-
const key = (0, toKey_js_1.default)(path[index]);
|
|
33
|
-
let newValue = value;
|
|
34
|
-
if (index !== lastIndex) {
|
|
35
|
-
const objValue = nested[key];
|
|
36
|
-
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
37
|
-
if (newValue === undefined) {
|
|
38
|
-
newValue = (0, isObject_js_1.default)(objValue)
|
|
39
|
-
? objValue
|
|
40
|
-
: (0, isIndex_js_1.default)(path[index + 1])
|
|
41
|
-
? []
|
|
42
|
-
: {};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
(0, assignValue_js_1.default)(nested, key, newValue);
|
|
46
|
-
nested = nested[key];
|
|
47
|
-
}
|
|
48
|
-
return object;
|
|
49
|
-
}
|
|
50
|
-
exports.default = baseSet;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The base implementation of `set`.
|
|
3
|
-
*
|
|
4
|
-
* @private
|
|
5
|
-
* @param {Object} object The object to modify.
|
|
6
|
-
* @param {Array|string} path The path of the property to set.
|
|
7
|
-
* @param {*} value The value to set.
|
|
8
|
-
* @param {Function} [customizer] The function to customize path creation.
|
|
9
|
-
* @returns {Object} Returns `object`.
|
|
10
|
-
*/
|
|
11
|
-
declare function baseSet(object: any, path: any, value: any, customizer: any): any;
|
|
12
|
-
export default baseSet;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import assignValue from "./assignValue.js";
|
|
3
|
-
import castPath from "./castPath.js";
|
|
4
|
-
import isIndex from "./isIndex.js";
|
|
5
|
-
import isObject from "./isObject.js";
|
|
6
|
-
import toKey from "./toKey.js";
|
|
7
|
-
/**
|
|
8
|
-
* The base implementation of `set`.
|
|
9
|
-
*
|
|
10
|
-
* @private
|
|
11
|
-
* @param {Object} object The object to modify.
|
|
12
|
-
* @param {Array|string} path The path of the property to set.
|
|
13
|
-
* @param {*} value The value to set.
|
|
14
|
-
* @param {Function} [customizer] The function to customize path creation.
|
|
15
|
-
* @returns {Object} Returns `object`.
|
|
16
|
-
*/
|
|
17
|
-
function baseSet(object, path, value, customizer) {
|
|
18
|
-
if (!isObject(object)) {
|
|
19
|
-
return object;
|
|
20
|
-
}
|
|
21
|
-
path = castPath(path, object);
|
|
22
|
-
const length = path.length;
|
|
23
|
-
const lastIndex = length - 1;
|
|
24
|
-
let index = -1;
|
|
25
|
-
let nested = object;
|
|
26
|
-
while (nested != null && ++index < length) {
|
|
27
|
-
const key = toKey(path[index]);
|
|
28
|
-
let newValue = value;
|
|
29
|
-
if (index !== lastIndex) {
|
|
30
|
-
const objValue = nested[key];
|
|
31
|
-
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
32
|
-
if (newValue === undefined) {
|
|
33
|
-
newValue = isObject(objValue)
|
|
34
|
-
? objValue
|
|
35
|
-
: isIndex(path[index + 1])
|
|
36
|
-
? []
|
|
37
|
-
: {};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
assignValue(nested, key, newValue);
|
|
41
|
-
nested = nested[key];
|
|
42
|
-
}
|
|
43
|
-
return object;
|
|
44
|
-
}
|
|
45
|
-
export default baseSet;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const isKey_js_1 = __importDefault(require("./isKey.cjs"));
|
|
7
|
-
const stringToPath_js_1 = __importDefault(require("./stringToPath.cjs"));
|
|
8
|
-
/**
|
|
9
|
-
* Casts `value` to a path array if it's not one.
|
|
10
|
-
*
|
|
11
|
-
* @private
|
|
12
|
-
* @param {*} value The value to inspect.
|
|
13
|
-
* @param {Object} [object] The object to query keys on.
|
|
14
|
-
* @returns {Array} Returns the cast property path array.
|
|
15
|
-
*/
|
|
16
|
-
function castPath(value, object) {
|
|
17
|
-
if (Array.isArray(value)) {
|
|
18
|
-
return value;
|
|
19
|
-
}
|
|
20
|
-
return (0, isKey_js_1.default)(value, object) ? [value] : (0, stringToPath_js_1.default)(value);
|
|
21
|
-
}
|
|
22
|
-
exports.default = castPath;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Casts `value` to a path array if it's not one.
|
|
3
|
-
*
|
|
4
|
-
* @private
|
|
5
|
-
* @param {*} value The value to inspect.
|
|
6
|
-
* @param {Object} [object] The object to query keys on.
|
|
7
|
-
* @returns {Array} Returns the cast property path array.
|
|
8
|
-
*/
|
|
9
|
-
declare function castPath(value: any, object: Record<string, any>): any;
|
|
10
|
-
export default castPath;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import isKey from "./isKey.js";
|
|
2
|
-
import stringToPath from "./stringToPath.js";
|
|
3
|
-
/**
|
|
4
|
-
* Casts `value` to a path array if it's not one.
|
|
5
|
-
*
|
|
6
|
-
* @private
|
|
7
|
-
* @param {*} value The value to inspect.
|
|
8
|
-
* @param {Object} [object] The object to query keys on.
|
|
9
|
-
* @returns {Array} Returns the cast property path array.
|
|
10
|
-
*/
|
|
11
|
-
function castPath(value, object) {
|
|
12
|
-
if (Array.isArray(value)) {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
return isKey(value, object) ? [value] : stringToPath(value);
|
|
16
|
-
}
|
|
17
|
-
export default castPath;
|
package/dist/utils/lodash/eq.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Performs a
|
|
5
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
6
|
-
* comparison between two values to determine if they are equivalent.
|
|
7
|
-
*
|
|
8
|
-
* @since 4.0.0
|
|
9
|
-
* @category Lang
|
|
10
|
-
* @param {*} value The value to compare.
|
|
11
|
-
* @param {*} other The other value to compare.
|
|
12
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
13
|
-
* @example
|
|
14
|
-
*
|
|
15
|
-
* const object = { 'a': 1 }
|
|
16
|
-
* const other = { 'a': 1 }
|
|
17
|
-
*
|
|
18
|
-
* eq(object, object)
|
|
19
|
-
* // => true
|
|
20
|
-
*
|
|
21
|
-
* eq(object, other)
|
|
22
|
-
* // => false
|
|
23
|
-
*
|
|
24
|
-
* eq('a', 'a')
|
|
25
|
-
* // => true
|
|
26
|
-
*
|
|
27
|
-
* eq('a', Object('a'))
|
|
28
|
-
* // => false
|
|
29
|
-
*
|
|
30
|
-
* eq(NaN, NaN)
|
|
31
|
-
* // => true
|
|
32
|
-
*/
|
|
33
|
-
function eq(value, other) {
|
|
34
|
-
return value === other || (value !== value && other !== other);
|
|
35
|
-
}
|
|
36
|
-
exports.default = eq;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performs a
|
|
3
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
4
|
-
* comparison between two values to determine if they are equivalent.
|
|
5
|
-
*
|
|
6
|
-
* @since 4.0.0
|
|
7
|
-
* @category Lang
|
|
8
|
-
* @param {*} value The value to compare.
|
|
9
|
-
* @param {*} other The other value to compare.
|
|
10
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
11
|
-
* @example
|
|
12
|
-
*
|
|
13
|
-
* const object = { 'a': 1 }
|
|
14
|
-
* const other = { 'a': 1 }
|
|
15
|
-
*
|
|
16
|
-
* eq(object, object)
|
|
17
|
-
* // => true
|
|
18
|
-
*
|
|
19
|
-
* eq(object, other)
|
|
20
|
-
* // => false
|
|
21
|
-
*
|
|
22
|
-
* eq('a', 'a')
|
|
23
|
-
* // => true
|
|
24
|
-
*
|
|
25
|
-
* eq('a', Object('a'))
|
|
26
|
-
* // => false
|
|
27
|
-
*
|
|
28
|
-
* eq(NaN, NaN)
|
|
29
|
-
* // => true
|
|
30
|
-
*/
|
|
31
|
-
declare function eq(value: any, other: any): boolean;
|
|
32
|
-
export default eq;
|
package/dist/utils/lodash/eq.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performs a
|
|
3
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
4
|
-
* comparison between two values to determine if they are equivalent.
|
|
5
|
-
*
|
|
6
|
-
* @since 4.0.0
|
|
7
|
-
* @category Lang
|
|
8
|
-
* @param {*} value The value to compare.
|
|
9
|
-
* @param {*} other The other value to compare.
|
|
10
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
11
|
-
* @example
|
|
12
|
-
*
|
|
13
|
-
* const object = { 'a': 1 }
|
|
14
|
-
* const other = { 'a': 1 }
|
|
15
|
-
*
|
|
16
|
-
* eq(object, object)
|
|
17
|
-
* // => true
|
|
18
|
-
*
|
|
19
|
-
* eq(object, other)
|
|
20
|
-
* // => false
|
|
21
|
-
*
|
|
22
|
-
* eq('a', 'a')
|
|
23
|
-
* // => true
|
|
24
|
-
*
|
|
25
|
-
* eq('a', Object('a'))
|
|
26
|
-
* // => false
|
|
27
|
-
*
|
|
28
|
-
* eq(NaN, NaN)
|
|
29
|
-
* // => true
|
|
30
|
-
*/
|
|
31
|
-
function eq(value, other) {
|
|
32
|
-
return value === other || (value !== value && other !== other);
|
|
33
|
-
}
|
|
34
|
-
export default eq;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const toString = Object.prototype.toString;
|
|
5
|
-
/**
|
|
6
|
-
* Gets the `toStringTag` of `value`.
|
|
7
|
-
*
|
|
8
|
-
* @private
|
|
9
|
-
* @param {*} value The value to query.
|
|
10
|
-
* @returns {string} Returns the `toStringTag`.
|
|
11
|
-
*/
|
|
12
|
-
function getTag(value) {
|
|
13
|
-
if (value == null) {
|
|
14
|
-
return value === undefined ? "[object Undefined]" : "[object Null]";
|
|
15
|
-
}
|
|
16
|
-
return toString.call(value);
|
|
17
|
-
}
|
|
18
|
-
exports.default = getTag;
|