langsmith 0.5.17 → 0.5.19
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/client.cjs +24 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +24 -0
- package/dist/experimental/anthropic/context.cjs +5 -0
- package/dist/experimental/anthropic/context.js +5 -0
- package/dist/experimental/anthropic/index.cjs +1 -0
- package/dist/experimental/anthropic/index.js +1 -0
- package/dist/experimental/sandbox/client.cjs +2 -0
- package/dist/experimental/sandbox/client.d.ts +2 -0
- package/dist/experimental/sandbox/client.js +2 -0
- package/dist/experimental/sandbox/index.cjs +0 -3
- package/dist/experimental/sandbox/index.js +0 -3
- package/dist/experimental/sandbox/sandbox.cjs +2 -0
- package/dist/experimental/sandbox/sandbox.d.ts +2 -0
- package/dist/experimental/sandbox/sandbox.js +2 -0
- package/dist/experimental/vercel/index.cjs +11 -0
- package/dist/experimental/vercel/index.js +12 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- 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,23 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import getTag from "./getTag.js";
|
|
3
|
-
/**
|
|
4
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
5
|
-
*
|
|
6
|
-
* @since 4.0.0
|
|
7
|
-
* @category Lang
|
|
8
|
-
* @param {*} value The value to check.
|
|
9
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
10
|
-
* @example
|
|
11
|
-
*
|
|
12
|
-
* isSymbol(Symbol.iterator)
|
|
13
|
-
* // => true
|
|
14
|
-
*
|
|
15
|
-
* isSymbol('abc')
|
|
16
|
-
* // => false
|
|
17
|
-
*/
|
|
18
|
-
function isSymbol(value) {
|
|
19
|
-
const type = typeof value;
|
|
20
|
-
return (type === "symbol" ||
|
|
21
|
-
(type === "object" && value != null && getTag(value) === "[object Symbol]"));
|
|
22
|
-
}
|
|
23
|
-
export default isSymbol;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/**
|
|
5
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
6
|
-
* provided, it determines the cache key for storing the result based on the
|
|
7
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
8
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
9
|
-
* is invoked with the `this` binding of the memoized function.
|
|
10
|
-
*
|
|
11
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
12
|
-
* function. Its creation may be customized by replacing the `memoize.Cache`
|
|
13
|
-
* constructor with one whose instances implement the
|
|
14
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
15
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
16
|
-
*
|
|
17
|
-
* @since 0.1.0
|
|
18
|
-
* @category Function
|
|
19
|
-
* @param {Function} func The function to have its output memoized.
|
|
20
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
21
|
-
* @returns {Function} Returns the new memoized function.
|
|
22
|
-
* @example
|
|
23
|
-
*
|
|
24
|
-
* const object = { 'a': 1, 'b': 2 }
|
|
25
|
-
* const other = { 'c': 3, 'd': 4 }
|
|
26
|
-
*
|
|
27
|
-
* const values = memoize(values)
|
|
28
|
-
* values(object)
|
|
29
|
-
* // => [1, 2]
|
|
30
|
-
*
|
|
31
|
-
* values(other)
|
|
32
|
-
* // => [3, 4]
|
|
33
|
-
*
|
|
34
|
-
* object.a = 2
|
|
35
|
-
* values(object)
|
|
36
|
-
* // => [1, 2]
|
|
37
|
-
*
|
|
38
|
-
* // Modify the result cache.
|
|
39
|
-
* values.cache.set(object, ['a', 'b'])
|
|
40
|
-
* values(object)
|
|
41
|
-
* // => ['a', 'b']
|
|
42
|
-
*
|
|
43
|
-
* // Replace `memoize.Cache`.
|
|
44
|
-
* memoize.Cache = WeakMap
|
|
45
|
-
*/
|
|
46
|
-
function memoize(func, resolver) {
|
|
47
|
-
if (typeof func !== "function" ||
|
|
48
|
-
(resolver != null && typeof resolver !== "function")) {
|
|
49
|
-
throw new TypeError("Expected a function");
|
|
50
|
-
}
|
|
51
|
-
const memoized = function (...args) {
|
|
52
|
-
const key = resolver ? resolver.apply(this, args) : args[0];
|
|
53
|
-
const cache = memoized.cache;
|
|
54
|
-
if (cache.has(key)) {
|
|
55
|
-
return cache.get(key);
|
|
56
|
-
}
|
|
57
|
-
const result = func.apply(this, args);
|
|
58
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
59
|
-
return result;
|
|
60
|
-
};
|
|
61
|
-
memoized.cache = new (memoize.Cache || Map)();
|
|
62
|
-
return memoized;
|
|
63
|
-
}
|
|
64
|
-
memoize.Cache = Map;
|
|
65
|
-
exports.default = memoize;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
3
|
-
* provided, it determines the cache key for storing the result based on the
|
|
4
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
5
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
6
|
-
* is invoked with the `this` binding of the memoized function.
|
|
7
|
-
*
|
|
8
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
9
|
-
* function. Its creation may be customized by replacing the `memoize.Cache`
|
|
10
|
-
* constructor with one whose instances implement the
|
|
11
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
12
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
13
|
-
*
|
|
14
|
-
* @since 0.1.0
|
|
15
|
-
* @category Function
|
|
16
|
-
* @param {Function} func The function to have its output memoized.
|
|
17
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
18
|
-
* @returns {Function} Returns the new memoized function.
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* const object = { 'a': 1, 'b': 2 }
|
|
22
|
-
* const other = { 'c': 3, 'd': 4 }
|
|
23
|
-
*
|
|
24
|
-
* const values = memoize(values)
|
|
25
|
-
* values(object)
|
|
26
|
-
* // => [1, 2]
|
|
27
|
-
*
|
|
28
|
-
* values(other)
|
|
29
|
-
* // => [3, 4]
|
|
30
|
-
*
|
|
31
|
-
* object.a = 2
|
|
32
|
-
* values(object)
|
|
33
|
-
* // => [1, 2]
|
|
34
|
-
*
|
|
35
|
-
* // Modify the result cache.
|
|
36
|
-
* values.cache.set(object, ['a', 'b'])
|
|
37
|
-
* values(object)
|
|
38
|
-
* // => ['a', 'b']
|
|
39
|
-
*
|
|
40
|
-
* // Replace `memoize.Cache`.
|
|
41
|
-
* memoize.Cache = WeakMap
|
|
42
|
-
*/
|
|
43
|
-
declare function memoize(func: any, resolver: any): {
|
|
44
|
-
(...args: any[]): any;
|
|
45
|
-
cache: Map<any, any>;
|
|
46
|
-
};
|
|
47
|
-
declare namespace memoize {
|
|
48
|
-
var Cache: MapConstructor;
|
|
49
|
-
}
|
|
50
|
-
export default memoize;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
4
|
-
* provided, it determines the cache key for storing the result based on the
|
|
5
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
6
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
7
|
-
* is invoked with the `this` binding of the memoized function.
|
|
8
|
-
*
|
|
9
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
10
|
-
* function. Its creation may be customized by replacing the `memoize.Cache`
|
|
11
|
-
* constructor with one whose instances implement the
|
|
12
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
13
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
14
|
-
*
|
|
15
|
-
* @since 0.1.0
|
|
16
|
-
* @category Function
|
|
17
|
-
* @param {Function} func The function to have its output memoized.
|
|
18
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
19
|
-
* @returns {Function} Returns the new memoized function.
|
|
20
|
-
* @example
|
|
21
|
-
*
|
|
22
|
-
* const object = { 'a': 1, 'b': 2 }
|
|
23
|
-
* const other = { 'c': 3, 'd': 4 }
|
|
24
|
-
*
|
|
25
|
-
* const values = memoize(values)
|
|
26
|
-
* values(object)
|
|
27
|
-
* // => [1, 2]
|
|
28
|
-
*
|
|
29
|
-
* values(other)
|
|
30
|
-
* // => [3, 4]
|
|
31
|
-
*
|
|
32
|
-
* object.a = 2
|
|
33
|
-
* values(object)
|
|
34
|
-
* // => [1, 2]
|
|
35
|
-
*
|
|
36
|
-
* // Modify the result cache.
|
|
37
|
-
* values.cache.set(object, ['a', 'b'])
|
|
38
|
-
* values(object)
|
|
39
|
-
* // => ['a', 'b']
|
|
40
|
-
*
|
|
41
|
-
* // Replace `memoize.Cache`.
|
|
42
|
-
* memoize.Cache = WeakMap
|
|
43
|
-
*/
|
|
44
|
-
function memoize(func, resolver) {
|
|
45
|
-
if (typeof func !== "function" ||
|
|
46
|
-
(resolver != null && typeof resolver !== "function")) {
|
|
47
|
-
throw new TypeError("Expected a function");
|
|
48
|
-
}
|
|
49
|
-
const memoized = function (...args) {
|
|
50
|
-
const key = resolver ? resolver.apply(this, args) : args[0];
|
|
51
|
-
const cache = memoized.cache;
|
|
52
|
-
if (cache.has(key)) {
|
|
53
|
-
return cache.get(key);
|
|
54
|
-
}
|
|
55
|
-
const result = func.apply(this, args);
|
|
56
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
57
|
-
return result;
|
|
58
|
-
};
|
|
59
|
-
memoized.cache = new (memoize.Cache || Map)();
|
|
60
|
-
return memoized;
|
|
61
|
-
}
|
|
62
|
-
memoize.Cache = Map;
|
|
63
|
-
export default memoize;
|
|
@@ -1,41 +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 baseSet_js_1 = __importDefault(require("./baseSet.cjs"));
|
|
8
|
-
/**
|
|
9
|
-
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
10
|
-
* it's created. Arrays are created for missing index properties while objects
|
|
11
|
-
* are created for all other missing properties. Use `setWith` to customize
|
|
12
|
-
* `path` creation.
|
|
13
|
-
*
|
|
14
|
-
* **Note:** This method mutates `object`.
|
|
15
|
-
*
|
|
16
|
-
* Inlined to just use set functionality and patch vulnerabilities
|
|
17
|
-
* on existing isolated "lodash.set" package.
|
|
18
|
-
*
|
|
19
|
-
* @since 3.7.0
|
|
20
|
-
* @category Object
|
|
21
|
-
* @param {Object} object The object to modify.
|
|
22
|
-
* @param {Array|string} path The path of the property to set.
|
|
23
|
-
* @param {*} value The value to set.
|
|
24
|
-
* @returns {Object} Returns `object`.
|
|
25
|
-
* @see has, hasIn, get, unset
|
|
26
|
-
* @example
|
|
27
|
-
*
|
|
28
|
-
* const object = { 'a': [{ 'b': { 'c': 3 } }] }
|
|
29
|
-
*
|
|
30
|
-
* set(object, 'a[0].b.c', 4)
|
|
31
|
-
* console.log(object.a[0].b.c)
|
|
32
|
-
* // => 4
|
|
33
|
-
*
|
|
34
|
-
* set(object, ['x', '0', 'y', 'z'], 5)
|
|
35
|
-
* console.log(object.x[0].y.z)
|
|
36
|
-
* // => 5
|
|
37
|
-
*/
|
|
38
|
-
function set(object, path, value) {
|
|
39
|
-
return object == null ? object : (0, baseSet_js_1.default)(object, path, value);
|
|
40
|
-
}
|
|
41
|
-
exports.default = set;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
3
|
-
* it's created. Arrays are created for missing index properties while objects
|
|
4
|
-
* are created for all other missing properties. Use `setWith` to customize
|
|
5
|
-
* `path` creation.
|
|
6
|
-
*
|
|
7
|
-
* **Note:** This method mutates `object`.
|
|
8
|
-
*
|
|
9
|
-
* Inlined to just use set functionality and patch vulnerabilities
|
|
10
|
-
* on existing isolated "lodash.set" package.
|
|
11
|
-
*
|
|
12
|
-
* @since 3.7.0
|
|
13
|
-
* @category Object
|
|
14
|
-
* @param {Object} object The object to modify.
|
|
15
|
-
* @param {Array|string} path The path of the property to set.
|
|
16
|
-
* @param {*} value The value to set.
|
|
17
|
-
* @returns {Object} Returns `object`.
|
|
18
|
-
* @see has, hasIn, get, unset
|
|
19
|
-
* @example
|
|
20
|
-
*
|
|
21
|
-
* const object = { 'a': [{ 'b': { 'c': 3 } }] }
|
|
22
|
-
*
|
|
23
|
-
* set(object, 'a[0].b.c', 4)
|
|
24
|
-
* console.log(object.a[0].b.c)
|
|
25
|
-
* // => 4
|
|
26
|
-
*
|
|
27
|
-
* set(object, ['x', '0', 'y', 'z'], 5)
|
|
28
|
-
* console.log(object.x[0].y.z)
|
|
29
|
-
* // => 5
|
|
30
|
-
*/
|
|
31
|
-
declare function set(object: any, path: any, value: any): any;
|
|
32
|
-
export default set;
|
package/dist/utils/lodash/set.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import baseSet from "./baseSet.js";
|
|
3
|
-
/**
|
|
4
|
-
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
5
|
-
* it's created. Arrays are created for missing index properties while objects
|
|
6
|
-
* are created for all other missing properties. Use `setWith` to customize
|
|
7
|
-
* `path` creation.
|
|
8
|
-
*
|
|
9
|
-
* **Note:** This method mutates `object`.
|
|
10
|
-
*
|
|
11
|
-
* Inlined to just use set functionality and patch vulnerabilities
|
|
12
|
-
* on existing isolated "lodash.set" package.
|
|
13
|
-
*
|
|
14
|
-
* @since 3.7.0
|
|
15
|
-
* @category Object
|
|
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
|
-
* @returns {Object} Returns `object`.
|
|
20
|
-
* @see has, hasIn, get, unset
|
|
21
|
-
* @example
|
|
22
|
-
*
|
|
23
|
-
* const object = { 'a': [{ 'b': { 'c': 3 } }] }
|
|
24
|
-
*
|
|
25
|
-
* set(object, 'a[0].b.c', 4)
|
|
26
|
-
* console.log(object.a[0].b.c)
|
|
27
|
-
* // => 4
|
|
28
|
-
*
|
|
29
|
-
* set(object, ['x', '0', 'y', 'z'], 5)
|
|
30
|
-
* console.log(object.x[0].y.z)
|
|
31
|
-
* // => 5
|
|
32
|
-
*/
|
|
33
|
-
function set(object, path, value) {
|
|
34
|
-
return object == null ? object : baseSet(object, path, value);
|
|
35
|
-
}
|
|
36
|
-
export default set;
|
|
@@ -1,49 +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 memoizeCapped_js_1 = __importDefault(require("./memoizeCapped.cjs"));
|
|
8
|
-
const charCodeOfDot = ".".charCodeAt(0);
|
|
9
|
-
const reEscapeChar = /\\(\\)?/g;
|
|
10
|
-
const rePropName = RegExp(
|
|
11
|
-
// Match anything that isn't a dot or bracket.
|
|
12
|
-
"[^.[\\]]+" +
|
|
13
|
-
"|" +
|
|
14
|
-
// Or match property names within brackets.
|
|
15
|
-
"\\[(?:" +
|
|
16
|
-
// Match a non-string expression.
|
|
17
|
-
"([^\"'][^[]*)" +
|
|
18
|
-
"|" +
|
|
19
|
-
// Or match strings (supports escaping characters).
|
|
20
|
-
"([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" +
|
|
21
|
-
")\\]" +
|
|
22
|
-
"|" +
|
|
23
|
-
// Or match "" as the space between consecutive dots or empty brackets.
|
|
24
|
-
"(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
25
|
-
/**
|
|
26
|
-
* Converts `string` to a property path array.
|
|
27
|
-
*
|
|
28
|
-
* @private
|
|
29
|
-
* @param {string} string The string to convert.
|
|
30
|
-
* @returns {Array} Returns the property path array.
|
|
31
|
-
*/
|
|
32
|
-
const stringToPath = (0, memoizeCapped_js_1.default)((string) => {
|
|
33
|
-
const result = [];
|
|
34
|
-
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
35
|
-
result.push("");
|
|
36
|
-
}
|
|
37
|
-
string.replace(rePropName, (match, expression, quote, subString) => {
|
|
38
|
-
let key = match;
|
|
39
|
-
if (quote) {
|
|
40
|
-
key = subString.replace(reEscapeChar, "$1");
|
|
41
|
-
}
|
|
42
|
-
else if (expression) {
|
|
43
|
-
key = expression.trim();
|
|
44
|
-
}
|
|
45
|
-
result.push(key);
|
|
46
|
-
});
|
|
47
|
-
return result;
|
|
48
|
-
});
|
|
49
|
-
exports.default = stringToPath;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts `string` to a property path array.
|
|
3
|
-
*
|
|
4
|
-
* @private
|
|
5
|
-
* @param {string} string The string to convert.
|
|
6
|
-
* @returns {Array} Returns the property path array.
|
|
7
|
-
*/
|
|
8
|
-
declare const stringToPath: {
|
|
9
|
-
(...args: any[]): any;
|
|
10
|
-
cache: Map<any, any>;
|
|
11
|
-
};
|
|
12
|
-
export default stringToPath;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import memoizeCapped from "./memoizeCapped.js";
|
|
3
|
-
const charCodeOfDot = ".".charCodeAt(0);
|
|
4
|
-
const reEscapeChar = /\\(\\)?/g;
|
|
5
|
-
const rePropName = RegExp(
|
|
6
|
-
// Match anything that isn't a dot or bracket.
|
|
7
|
-
"[^.[\\]]+" +
|
|
8
|
-
"|" +
|
|
9
|
-
// Or match property names within brackets.
|
|
10
|
-
"\\[(?:" +
|
|
11
|
-
// Match a non-string expression.
|
|
12
|
-
"([^\"'][^[]*)" +
|
|
13
|
-
"|" +
|
|
14
|
-
// Or match strings (supports escaping characters).
|
|
15
|
-
"([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" +
|
|
16
|
-
")\\]" +
|
|
17
|
-
"|" +
|
|
18
|
-
// Or match "" as the space between consecutive dots or empty brackets.
|
|
19
|
-
"(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
20
|
-
/**
|
|
21
|
-
* Converts `string` to a property path array.
|
|
22
|
-
*
|
|
23
|
-
* @private
|
|
24
|
-
* @param {string} string The string to convert.
|
|
25
|
-
* @returns {Array} Returns the property path array.
|
|
26
|
-
*/
|
|
27
|
-
const stringToPath = memoizeCapped((string) => {
|
|
28
|
-
const result = [];
|
|
29
|
-
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
30
|
-
result.push("");
|
|
31
|
-
}
|
|
32
|
-
string.replace(rePropName, (match, expression, quote, subString) => {
|
|
33
|
-
let key = match;
|
|
34
|
-
if (quote) {
|
|
35
|
-
key = subString.replace(reEscapeChar, "$1");
|
|
36
|
-
}
|
|
37
|
-
else if (expression) {
|
|
38
|
-
key = expression.trim();
|
|
39
|
-
}
|
|
40
|
-
result.push(key);
|
|
41
|
-
});
|
|
42
|
-
return result;
|
|
43
|
-
});
|
|
44
|
-
export default stringToPath;
|
|
@@ -1,24 +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 isSymbol_js_1 = __importDefault(require("./isSymbol.cjs"));
|
|
8
|
-
/** Used as references for various `Number` constants. */
|
|
9
|
-
const INFINITY = 1 / 0;
|
|
10
|
-
/**
|
|
11
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
12
|
-
*
|
|
13
|
-
* @private
|
|
14
|
-
* @param {*} value The value to inspect.
|
|
15
|
-
* @returns {string|symbol} Returns the key.
|
|
16
|
-
*/
|
|
17
|
-
function toKey(value) {
|
|
18
|
-
if (typeof value === "string" || (0, isSymbol_js_1.default)(value)) {
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
const result = `${value}`;
|
|
22
|
-
return result === "0" && 1 / value === -INFINITY ? "-0" : result;
|
|
23
|
-
}
|
|
24
|
-
exports.default = toKey;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import isSymbol from "./isSymbol.js";
|
|
3
|
-
/** Used as references for various `Number` constants. */
|
|
4
|
-
const INFINITY = 1 / 0;
|
|
5
|
-
/**
|
|
6
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
7
|
-
*
|
|
8
|
-
* @private
|
|
9
|
-
* @param {*} value The value to inspect.
|
|
10
|
-
* @returns {string|symbol} Returns the key.
|
|
11
|
-
*/
|
|
12
|
-
function toKey(value) {
|
|
13
|
-
if (typeof value === "string" || isSymbol(value)) {
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
const result = `${value}`;
|
|
17
|
-
return result === "0" && 1 / value === -INFINITY ? "-0" : result;
|
|
18
|
-
}
|
|
19
|
-
export default toKey;
|