langsmith 0.1.34 → 0.1.36
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 +2 -2
- package/dist/anonymizer/index.js +1 -1
- package/dist/client.cjs +18 -2
- package/dist/client.d.ts +4 -1
- package/dist/client.js +18 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/lodash/assignValue.cjs +29 -0
- package/dist/utils/lodash/assignValue.d.ts +10 -0
- package/dist/utils/lodash/assignValue.js +24 -0
- package/dist/utils/lodash/baseAssignValue.cjs +25 -0
- package/dist/utils/lodash/baseAssignValue.d.ts +11 -0
- package/dist/utils/lodash/baseAssignValue.js +23 -0
- package/dist/utils/lodash/baseSet.cjs +50 -0
- package/dist/utils/lodash/baseSet.d.ts +12 -0
- package/dist/utils/lodash/baseSet.js +45 -0
- package/dist/utils/lodash/castPath.cjs +22 -0
- package/dist/utils/lodash/castPath.d.ts +10 -0
- package/dist/utils/lodash/castPath.js +17 -0
- package/dist/utils/lodash/eq.cjs +36 -0
- package/dist/utils/lodash/eq.d.ts +32 -0
- package/dist/utils/lodash/eq.js +34 -0
- package/dist/utils/lodash/getTag.cjs +18 -0
- package/dist/utils/lodash/getTag.d.ts +9 -0
- package/dist/utils/lodash/getTag.js +16 -0
- package/dist/utils/lodash/isIndex.cjs +25 -0
- package/dist/utils/lodash/isIndex.d.ts +10 -0
- package/dist/utils/lodash/isIndex.js +23 -0
- package/dist/utils/lodash/isKey.cjs +34 -0
- package/dist/utils/lodash/isKey.d.ts +10 -0
- package/dist/utils/lodash/isKey.js +29 -0
- package/dist/utils/lodash/isObject.cjs +31 -0
- package/dist/utils/lodash/isObject.d.ts +25 -0
- package/dist/utils/lodash/isObject.js +29 -0
- package/dist/utils/lodash/isSymbol.cjs +28 -0
- package/dist/utils/lodash/isSymbol.d.ts +17 -0
- package/dist/utils/lodash/isSymbol.js +23 -0
- package/dist/utils/lodash/memoizeCapped.cjs +65 -0
- package/dist/utils/lodash/memoizeCapped.d.ts +50 -0
- package/dist/utils/lodash/memoizeCapped.js +63 -0
- package/dist/utils/lodash/set.cjs +41 -0
- package/dist/utils/lodash/set.d.ts +32 -0
- package/dist/utils/lodash/set.js +36 -0
- package/dist/utils/lodash/stringToPath.cjs +49 -0
- package/dist/utils/lodash/stringToPath.d.ts +12 -0
- package/dist/utils/lodash/stringToPath.js +44 -0
- package/dist/utils/lodash/toKey.cjs +24 -0
- package/dist/utils/lodash/toKey.d.ts +9 -0
- package/dist/utils/lodash/toKey.js +19 -0
- package/package.json +1 -3
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createAnonymizer = void 0;
|
|
7
|
-
const
|
|
7
|
+
const set_js_1 = __importDefault(require("../utils/lodash/set.cjs"));
|
|
8
8
|
function extractStringNodes(data, options) {
|
|
9
9
|
const parsedOptions = { ...options, maxDepth: options.maxDepth ?? 10 };
|
|
10
10
|
const queue = [
|
|
@@ -93,7 +93,7 @@ function createAnonymizer(replacer, options) {
|
|
|
93
93
|
mutateValue = node.value;
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
(0,
|
|
96
|
+
(0, set_js_1.default)(mutateValue, node.path, node.value);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
return mutateValue;
|
package/dist/anonymizer/index.js
CHANGED
package/dist/client.cjs
CHANGED
|
@@ -1570,7 +1570,7 @@ class Client {
|
|
|
1570
1570
|
const path = `/examples/${exampleId}`;
|
|
1571
1571
|
return await this._get(path);
|
|
1572
1572
|
}
|
|
1573
|
-
async *listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, } = {}) {
|
|
1573
|
+
async *listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, limit, offset, filter, } = {}) {
|
|
1574
1574
|
let datasetId_;
|
|
1575
1575
|
if (datasetId !== undefined && datasetName !== undefined) {
|
|
1576
1576
|
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
@@ -1610,8 +1610,24 @@ class Client {
|
|
|
1610
1610
|
const serializedMetadata = JSON.stringify(metadata);
|
|
1611
1611
|
params.append("metadata", serializedMetadata);
|
|
1612
1612
|
}
|
|
1613
|
+
if (limit !== undefined) {
|
|
1614
|
+
params.append("limit", limit.toString());
|
|
1615
|
+
}
|
|
1616
|
+
if (offset !== undefined) {
|
|
1617
|
+
params.append("offset", offset.toString());
|
|
1618
|
+
}
|
|
1619
|
+
if (filter !== undefined) {
|
|
1620
|
+
params.append("filter", filter);
|
|
1621
|
+
}
|
|
1622
|
+
let i = 0;
|
|
1613
1623
|
for await (const examples of this._getPaginated("/examples", params)) {
|
|
1614
|
-
|
|
1624
|
+
for (const example of examples) {
|
|
1625
|
+
yield example;
|
|
1626
|
+
i++;
|
|
1627
|
+
}
|
|
1628
|
+
if (limit !== undefined && i >= limit) {
|
|
1629
|
+
break;
|
|
1630
|
+
}
|
|
1615
1631
|
}
|
|
1616
1632
|
}
|
|
1617
1633
|
async deleteExample(exampleId) {
|
package/dist/client.d.ts
CHANGED
|
@@ -416,7 +416,7 @@ export declare class Client {
|
|
|
416
416
|
createLLMExample(input: string, generation: string | undefined, options: CreateExampleOptions): Promise<Example>;
|
|
417
417
|
createChatExample(input: KVMap[] | LangChainBaseMessage[], generations: KVMap | LangChainBaseMessage | undefined, options: CreateExampleOptions): Promise<Example>;
|
|
418
418
|
readExample(exampleId: string): Promise<Example>;
|
|
419
|
-
listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, }?: {
|
|
419
|
+
listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, limit, offset, filter, }?: {
|
|
420
420
|
datasetId?: string;
|
|
421
421
|
datasetName?: string;
|
|
422
422
|
exampleIds?: string[];
|
|
@@ -424,6 +424,9 @@ export declare class Client {
|
|
|
424
424
|
splits?: string[];
|
|
425
425
|
inlineS3Urls?: boolean;
|
|
426
426
|
metadata?: KVMap;
|
|
427
|
+
limit?: number;
|
|
428
|
+
offset?: number;
|
|
429
|
+
filter?: string;
|
|
427
430
|
}): AsyncIterable<Example>;
|
|
428
431
|
deleteExample(exampleId: string): Promise<void>;
|
|
429
432
|
updateExample(exampleId: string, update: ExampleUpdate): Promise<object>;
|
package/dist/client.js
CHANGED
|
@@ -1543,7 +1543,7 @@ export class Client {
|
|
|
1543
1543
|
const path = `/examples/${exampleId}`;
|
|
1544
1544
|
return await this._get(path);
|
|
1545
1545
|
}
|
|
1546
|
-
async *listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, } = {}) {
|
|
1546
|
+
async *listExamples({ datasetId, datasetName, exampleIds, asOf, splits, inlineS3Urls, metadata, limit, offset, filter, } = {}) {
|
|
1547
1547
|
let datasetId_;
|
|
1548
1548
|
if (datasetId !== undefined && datasetName !== undefined) {
|
|
1549
1549
|
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
@@ -1583,8 +1583,24 @@ export class Client {
|
|
|
1583
1583
|
const serializedMetadata = JSON.stringify(metadata);
|
|
1584
1584
|
params.append("metadata", serializedMetadata);
|
|
1585
1585
|
}
|
|
1586
|
+
if (limit !== undefined) {
|
|
1587
|
+
params.append("limit", limit.toString());
|
|
1588
|
+
}
|
|
1589
|
+
if (offset !== undefined) {
|
|
1590
|
+
params.append("offset", offset.toString());
|
|
1591
|
+
}
|
|
1592
|
+
if (filter !== undefined) {
|
|
1593
|
+
params.append("filter", filter);
|
|
1594
|
+
}
|
|
1595
|
+
let i = 0;
|
|
1586
1596
|
for await (const examples of this._getPaginated("/examples", params)) {
|
|
1587
|
-
|
|
1597
|
+
for (const example of examples) {
|
|
1598
|
+
yield example;
|
|
1599
|
+
i++;
|
|
1600
|
+
}
|
|
1601
|
+
if (limit !== undefined && i >= limit) {
|
|
1602
|
+
break;
|
|
1603
|
+
}
|
|
1588
1604
|
}
|
|
1589
1605
|
}
|
|
1590
1606
|
async deleteExample(exampleId) {
|
package/dist/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "Client", { enumerable: true, get: function () {
|
|
|
6
6
|
var run_trees_js_1 = require("./run_trees.cjs");
|
|
7
7
|
Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () { return run_trees_js_1.RunTree; } });
|
|
8
8
|
// Update using yarn bump-version
|
|
9
|
-
exports.__version__ = "0.1.
|
|
9
|
+
exports.__version__ = "0.1.36";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Client } from "./client.js";
|
|
2
2
|
export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
|
|
3
3
|
export { RunTree, type RunTreeConfig } from "./run_trees.js";
|
|
4
|
-
export declare const __version__ = "0.1.
|
|
4
|
+
export declare const __version__ = "0.1.36";
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
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;
|
|
@@ -0,0 +1,50 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,45 @@
|
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
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;
|
|
@@ -0,0 +1,36 @@
|
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
|
@@ -0,0 +1,18 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
const toString = Object.prototype.toString;
|
|
3
|
+
/**
|
|
4
|
+
* Gets the `toStringTag` of `value`.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
* @param {*} value The value to query.
|
|
8
|
+
* @returns {string} Returns the `toStringTag`.
|
|
9
|
+
*/
|
|
10
|
+
function getTag(value) {
|
|
11
|
+
if (value == null) {
|
|
12
|
+
return value === undefined ? "[object Undefined]" : "[object Null]";
|
|
13
|
+
}
|
|
14
|
+
return toString.call(value);
|
|
15
|
+
}
|
|
16
|
+
export default getTag;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/** Used as references for various `Number` constants. */
|
|
5
|
+
const MAX_SAFE_INTEGER = 9007199254740991;
|
|
6
|
+
/** Used to detect unsigned integer values. */
|
|
7
|
+
const reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if `value` is a valid array-like index.
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
* @param {*} value The value to check.
|
|
13
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
14
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
15
|
+
*/
|
|
16
|
+
function isIndex(value, length) {
|
|
17
|
+
const type = typeof value;
|
|
18
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
19
|
+
return (!!length &&
|
|
20
|
+
(type === "number" || (type !== "symbol" && reIsUint.test(value))) &&
|
|
21
|
+
value > -1 &&
|
|
22
|
+
value % 1 === 0 &&
|
|
23
|
+
value < length);
|
|
24
|
+
}
|
|
25
|
+
exports.default = isIndex;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if `value` is a valid array-like index.
|
|
3
|
+
*
|
|
4
|
+
* @private
|
|
5
|
+
* @param {*} value The value to check.
|
|
6
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
7
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
8
|
+
*/
|
|
9
|
+
declare function isIndex(value: any, length: any): boolean;
|
|
10
|
+
export default isIndex;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/** Used as references for various `Number` constants. */
|
|
3
|
+
const MAX_SAFE_INTEGER = 9007199254740991;
|
|
4
|
+
/** Used to detect unsigned integer values. */
|
|
5
|
+
const reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if `value` is a valid array-like index.
|
|
8
|
+
*
|
|
9
|
+
* @private
|
|
10
|
+
* @param {*} value The value to check.
|
|
11
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
12
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
13
|
+
*/
|
|
14
|
+
function isIndex(value, length) {
|
|
15
|
+
const type = typeof value;
|
|
16
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
17
|
+
return (!!length &&
|
|
18
|
+
(type === "number" || (type !== "symbol" && reIsUint.test(value))) &&
|
|
19
|
+
value > -1 &&
|
|
20
|
+
value % 1 === 0 &&
|
|
21
|
+
value < length);
|
|
22
|
+
}
|
|
23
|
+
export default isIndex;
|