es-toolkit 1.32.0-dev.1011 → 1.32.0-dev.1012
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/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/index.d.mts +2 -0
- package/dist/compat/index.d.ts +2 -0
- package/dist/compat/index.js +16 -0
- package/dist/compat/index.mjs +2 -0
- package/dist/compat/object/values.d.mts +32 -0
- package/dist/compat/object/values.d.ts +32 -0
- package/dist/compat/object/values.mjs +5 -0
- package/dist/compat/object/valuesIn.d.mts +63 -0
- package/dist/compat/object/valuesIn.d.ts +63 -0
- package/dist/compat/object/valuesIn.mjs +13 -0
- package/package.json +1 -1
package/dist/compat/index.d.mts
CHANGED
|
@@ -186,6 +186,8 @@ export { propertyOf } from './object/propertyOf.mjs';
|
|
|
186
186
|
export { set } from './object/set.mjs';
|
|
187
187
|
export { toDefaulted } from './object/toDefaulted.mjs';
|
|
188
188
|
export { unset } from './object/unset.mjs';
|
|
189
|
+
export { values } from './object/values.mjs';
|
|
190
|
+
export { valuesIn } from './object/valuesIn.mjs';
|
|
189
191
|
export { conforms } from './predicate/conforms.mjs';
|
|
190
192
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
191
193
|
export { isArguments } from './predicate/isArguments.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -186,6 +186,8 @@ export { propertyOf } from './object/propertyOf.js';
|
|
|
186
186
|
export { set } from './object/set.js';
|
|
187
187
|
export { toDefaulted } from './object/toDefaulted.js';
|
|
188
188
|
export { unset } from './object/unset.js';
|
|
189
|
+
export { values } from './object/values.js';
|
|
190
|
+
export { valuesIn } from './object/valuesIn.js';
|
|
189
191
|
export { conforms } from './predicate/conforms.js';
|
|
190
192
|
export { conformsTo } from './predicate/conformsTo.js';
|
|
191
193
|
export { isArguments } from './predicate/isArguments.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -2736,6 +2736,20 @@ function toDefaulted(object, ...sources) {
|
|
|
2736
2736
|
return defaults(cloned, ...sources);
|
|
2737
2737
|
}
|
|
2738
2738
|
|
|
2739
|
+
function values(object) {
|
|
2740
|
+
return Object.values(object);
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
function valuesIn(object) {
|
|
2744
|
+
const keys = keysIn(object);
|
|
2745
|
+
const result = new Array(keys.length);
|
|
2746
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2747
|
+
const key = keys[i];
|
|
2748
|
+
result[i] = object[key];
|
|
2749
|
+
}
|
|
2750
|
+
return result;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2739
2753
|
function conformsTo(target, source) {
|
|
2740
2754
|
if (source == null) {
|
|
2741
2755
|
return true;
|
|
@@ -3576,6 +3590,8 @@ exports.unset = unset;
|
|
|
3576
3590
|
exports.unzip = unzip;
|
|
3577
3591
|
exports.upperCase = upperCase;
|
|
3578
3592
|
exports.upperFirst = upperFirst;
|
|
3593
|
+
exports.values = values;
|
|
3594
|
+
exports.valuesIn = valuesIn;
|
|
3579
3595
|
exports.without = without;
|
|
3580
3596
|
exports.words = words;
|
|
3581
3597
|
exports.zip = zip;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -188,6 +188,8 @@ export { propertyOf } from './object/propertyOf.mjs';
|
|
|
188
188
|
export { set } from './object/set.mjs';
|
|
189
189
|
export { toDefaulted } from './object/toDefaulted.mjs';
|
|
190
190
|
export { unset } from './object/unset.mjs';
|
|
191
|
+
export { values } from './object/values.mjs';
|
|
192
|
+
export { valuesIn } from './object/valuesIn.mjs';
|
|
191
193
|
export { conforms } from './predicate/conforms.mjs';
|
|
192
194
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
193
195
|
export { isArguments } from './predicate/isArguments.mjs';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of the own enumerable property values of `object`.
|
|
3
|
+
*
|
|
4
|
+
* @param {Record<PropertyKey, T> | null | undefined} object The object to query.
|
|
5
|
+
* @returns {T[]} Returns an array of property values.
|
|
6
|
+
* @example
|
|
7
|
+
* const object = { a: 1, b: 2 };
|
|
8
|
+
* values(object); // => [1, 2]
|
|
9
|
+
*/
|
|
10
|
+
declare function values<T>(object: Record<PropertyKey, T> | null | undefined): T[];
|
|
11
|
+
/**
|
|
12
|
+
* Creates an array of the values of an array or array-like object.
|
|
13
|
+
*
|
|
14
|
+
* @param {ArrayLike<T>} arr The array or array-like object to query.
|
|
15
|
+
* @returns {T[]} Returns an array of values.
|
|
16
|
+
* @example
|
|
17
|
+
* const array = ['a', 'b'];
|
|
18
|
+
* values(arrayLike); // => ['a', 'b']
|
|
19
|
+
*/
|
|
20
|
+
declare function values<T>(arr: ArrayLike<T>): T[];
|
|
21
|
+
/**
|
|
22
|
+
* Creates an array of the own enumerable property values of `object`.
|
|
23
|
+
*
|
|
24
|
+
* @param {T | null | undefined} object The object to query.
|
|
25
|
+
* @returns {Array<T[keyof T]>} Returns an array of property values.
|
|
26
|
+
* @example
|
|
27
|
+
* const obj = { x: 1, y: 2, z: 3 };
|
|
28
|
+
* values(obj); // => [1, 2, 3]
|
|
29
|
+
*/
|
|
30
|
+
declare function values<T extends object>(object: T | null | undefined): Array<T[keyof T]>;
|
|
31
|
+
|
|
32
|
+
export { values };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of the own enumerable property values of `object`.
|
|
3
|
+
*
|
|
4
|
+
* @param {Record<PropertyKey, T> | null | undefined} object The object to query.
|
|
5
|
+
* @returns {T[]} Returns an array of property values.
|
|
6
|
+
* @example
|
|
7
|
+
* const object = { a: 1, b: 2 };
|
|
8
|
+
* values(object); // => [1, 2]
|
|
9
|
+
*/
|
|
10
|
+
declare function values<T>(object: Record<PropertyKey, T> | null | undefined): T[];
|
|
11
|
+
/**
|
|
12
|
+
* Creates an array of the values of an array or array-like object.
|
|
13
|
+
*
|
|
14
|
+
* @param {ArrayLike<T>} arr The array or array-like object to query.
|
|
15
|
+
* @returns {T[]} Returns an array of values.
|
|
16
|
+
* @example
|
|
17
|
+
* const array = ['a', 'b'];
|
|
18
|
+
* values(arrayLike); // => ['a', 'b']
|
|
19
|
+
*/
|
|
20
|
+
declare function values<T>(arr: ArrayLike<T>): T[];
|
|
21
|
+
/**
|
|
22
|
+
* Creates an array of the own enumerable property values of `object`.
|
|
23
|
+
*
|
|
24
|
+
* @param {T | null | undefined} object The object to query.
|
|
25
|
+
* @returns {Array<T[keyof T]>} Returns an array of property values.
|
|
26
|
+
* @example
|
|
27
|
+
* const obj = { x: 1, y: 2, z: 3 };
|
|
28
|
+
* values(obj); // => [1, 2, 3]
|
|
29
|
+
*/
|
|
30
|
+
declare function values<T extends object>(object: T | null | undefined): Array<T[keyof T]>;
|
|
31
|
+
|
|
32
|
+
export { values };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the values from an object, including those inherited from its prototype.
|
|
3
|
+
*
|
|
4
|
+
* - If the value is not an object, it is converted to an object.
|
|
5
|
+
* - Array-like objects are treated like arrays.
|
|
6
|
+
* - Sparse arrays with some missing indices are treated like dense arrays.
|
|
7
|
+
* - If the value is `null` or `undefined`, an empty array is returned.
|
|
8
|
+
* - When handling prototype objects, the `constructor` property is excluded from the results.
|
|
9
|
+
*
|
|
10
|
+
* @param {Record<PropertyKey, T> | null | undefined} object The object to query.
|
|
11
|
+
* @returns {T[]} Returns an array of property values.
|
|
12
|
+
* @example
|
|
13
|
+
* const object = { a: 1, b: 2 };
|
|
14
|
+
* valuesIn(object); // => [1, 2]
|
|
15
|
+
*
|
|
16
|
+
* const arr = [1, 2, 3];
|
|
17
|
+
* valuesIn(arr); // => [1, 2, 3]
|
|
18
|
+
*
|
|
19
|
+
* function Foo() {
|
|
20
|
+
* this.a = 1;
|
|
21
|
+
* }
|
|
22
|
+
* Foo.prototype.b = 2;
|
|
23
|
+
* const foo = new Foo();
|
|
24
|
+
* valuesIn(foo); // => [1] (includes inherited properties)
|
|
25
|
+
*
|
|
26
|
+
* const objWithLength = { 0: 'a', 1: 'b', length: 2 };
|
|
27
|
+
* valuesIn(objWithLength); // => ['a', 'b', 2]
|
|
28
|
+
*/
|
|
29
|
+
declare function valuesIn<T>(object: Record<PropertyKey, T> | null | undefined): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the values from an object, including those inherited from its prototype.
|
|
32
|
+
*
|
|
33
|
+
* - If the value is not an object, it is converted to an object.
|
|
34
|
+
* - Array-like objects are treated like arrays.
|
|
35
|
+
* - Sparse arrays with some missing indices are treated like dense arrays.
|
|
36
|
+
* - If the value is `null` or `undefined`, an empty array is returned.
|
|
37
|
+
* - When handling prototype objects, the `constructor` property is excluded from the results.
|
|
38
|
+
*
|
|
39
|
+
* @param {ArrayLike<T>} arr The array or array-like object to query.
|
|
40
|
+
* @returns {T[]} Returns an array of values.
|
|
41
|
+
* @example
|
|
42
|
+
* const arrayLike = { 0: 'a', 1: 'b', length: 2 };
|
|
43
|
+
* valuesIn(arrayLike); // => ['a', 'b']
|
|
44
|
+
*/
|
|
45
|
+
declare function valuesIn<T>(arr: ArrayLike<T>): T[];
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the values from an object, including those inherited from its prototype.
|
|
48
|
+
*
|
|
49
|
+
* - If the value is not an object, it is converted to an object.
|
|
50
|
+
* - Array-like objects are treated like arrays.
|
|
51
|
+
* - Sparse arrays with some missing indices are treated like dense arrays.
|
|
52
|
+
* - If the value is `null` or `undefined`, an empty array is returned.
|
|
53
|
+
* - When handling prototype objects, the `constructor` property is excluded from the results.
|
|
54
|
+
*
|
|
55
|
+
* @param {T | null | undefined} object The object to query.
|
|
56
|
+
* @returns {Array<T[keyof T]>} Returns an array of property values.
|
|
57
|
+
* @example
|
|
58
|
+
* const obj = { x: 1, y: 2, z: 3 };
|
|
59
|
+
* valuesIn(obj); // => [1, 2, 3]
|
|
60
|
+
*/
|
|
61
|
+
declare function valuesIn<T extends object>(object: T | null | undefined): Array<T[keyof T]>;
|
|
62
|
+
|
|
63
|
+
export { valuesIn };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the values from an object, including those inherited from its prototype.
|
|
3
|
+
*
|
|
4
|
+
* - If the value is not an object, it is converted to an object.
|
|
5
|
+
* - Array-like objects are treated like arrays.
|
|
6
|
+
* - Sparse arrays with some missing indices are treated like dense arrays.
|
|
7
|
+
* - If the value is `null` or `undefined`, an empty array is returned.
|
|
8
|
+
* - When handling prototype objects, the `constructor` property is excluded from the results.
|
|
9
|
+
*
|
|
10
|
+
* @param {Record<PropertyKey, T> | null | undefined} object The object to query.
|
|
11
|
+
* @returns {T[]} Returns an array of property values.
|
|
12
|
+
* @example
|
|
13
|
+
* const object = { a: 1, b: 2 };
|
|
14
|
+
* valuesIn(object); // => [1, 2]
|
|
15
|
+
*
|
|
16
|
+
* const arr = [1, 2, 3];
|
|
17
|
+
* valuesIn(arr); // => [1, 2, 3]
|
|
18
|
+
*
|
|
19
|
+
* function Foo() {
|
|
20
|
+
* this.a = 1;
|
|
21
|
+
* }
|
|
22
|
+
* Foo.prototype.b = 2;
|
|
23
|
+
* const foo = new Foo();
|
|
24
|
+
* valuesIn(foo); // => [1] (includes inherited properties)
|
|
25
|
+
*
|
|
26
|
+
* const objWithLength = { 0: 'a', 1: 'b', length: 2 };
|
|
27
|
+
* valuesIn(objWithLength); // => ['a', 'b', 2]
|
|
28
|
+
*/
|
|
29
|
+
declare function valuesIn<T>(object: Record<PropertyKey, T> | null | undefined): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the values from an object, including those inherited from its prototype.
|
|
32
|
+
*
|
|
33
|
+
* - If the value is not an object, it is converted to an object.
|
|
34
|
+
* - Array-like objects are treated like arrays.
|
|
35
|
+
* - Sparse arrays with some missing indices are treated like dense arrays.
|
|
36
|
+
* - If the value is `null` or `undefined`, an empty array is returned.
|
|
37
|
+
* - When handling prototype objects, the `constructor` property is excluded from the results.
|
|
38
|
+
*
|
|
39
|
+
* @param {ArrayLike<T>} arr The array or array-like object to query.
|
|
40
|
+
* @returns {T[]} Returns an array of values.
|
|
41
|
+
* @example
|
|
42
|
+
* const arrayLike = { 0: 'a', 1: 'b', length: 2 };
|
|
43
|
+
* valuesIn(arrayLike); // => ['a', 'b']
|
|
44
|
+
*/
|
|
45
|
+
declare function valuesIn<T>(arr: ArrayLike<T>): T[];
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the values from an object, including those inherited from its prototype.
|
|
48
|
+
*
|
|
49
|
+
* - If the value is not an object, it is converted to an object.
|
|
50
|
+
* - Array-like objects are treated like arrays.
|
|
51
|
+
* - Sparse arrays with some missing indices are treated like dense arrays.
|
|
52
|
+
* - If the value is `null` or `undefined`, an empty array is returned.
|
|
53
|
+
* - When handling prototype objects, the `constructor` property is excluded from the results.
|
|
54
|
+
*
|
|
55
|
+
* @param {T | null | undefined} object The object to query.
|
|
56
|
+
* @returns {Array<T[keyof T]>} Returns an array of property values.
|
|
57
|
+
* @example
|
|
58
|
+
* const obj = { x: 1, y: 2, z: 3 };
|
|
59
|
+
* valuesIn(obj); // => [1, 2, 3]
|
|
60
|
+
*/
|
|
61
|
+
declare function valuesIn<T extends object>(object: T | null | undefined): Array<T[keyof T]>;
|
|
62
|
+
|
|
63
|
+
export { valuesIn };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { keysIn } from './keysIn.mjs';
|
|
2
|
+
|
|
3
|
+
function valuesIn(object) {
|
|
4
|
+
const keys = keysIn(object);
|
|
5
|
+
const result = new Array(keys.length);
|
|
6
|
+
for (let i = 0; i < keys.length; i++) {
|
|
7
|
+
const key = keys[i];
|
|
8
|
+
result[i] = object[key];
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { valuesIn };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-toolkit",
|
|
3
3
|
"description": "A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.",
|
|
4
|
-
"version": "1.32.0-dev.
|
|
4
|
+
"version": "1.32.0-dev.1012+b8da6946",
|
|
5
5
|
"homepage": "https://es-toolkit.slash.page",
|
|
6
6
|
"bugs": "https://github.com/toss/es-toolkit/issues",
|
|
7
7
|
"repository": {
|