@types/sort-keys-length 2.0.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.
- sort-keys-length/LICENSE +21 -0
- sort-keys-length/README.md +61 -0
- sort-keys-length/index.d.ts +42 -0
- sort-keys-length/package.json +26 -0
sort-keys-length/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
> `npm install --save @types/sort-keys-length`
|
|
3
|
+
|
|
4
|
+
# Summary
|
|
5
|
+
This package contains type definitions for sort-keys-length (https://github.com/kevva/sort-keys-length).
|
|
6
|
+
|
|
7
|
+
# Details
|
|
8
|
+
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sort-keys-length.
|
|
9
|
+
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sort-keys-length/index.d.ts)
|
|
10
|
+
````ts
|
|
11
|
+
/**
|
|
12
|
+
* Options for sorting object keys by length.
|
|
13
|
+
*/
|
|
14
|
+
interface SortKeysLengthOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Recursively sort keys.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
deep?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Sort object keys by length in ascending order (shortest first).
|
|
24
|
+
*
|
|
25
|
+
* @param object - Object to sort
|
|
26
|
+
* @param options - Sort options
|
|
27
|
+
* @returns A new object with keys sorted by length in ascending order
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```javascript
|
|
31
|
+
* sortKeysLength.asc({ab: 'x', a: 'y', abc: 'z'});
|
|
32
|
+
* //=> {a: 'y', ab: 'x', abc: 'z'}
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function asc<T extends object>(object: T, options?: SortKeysLengthOptions): T;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Sort object keys by length in descending order (longest first).
|
|
39
|
+
*
|
|
40
|
+
* @param object - Object to sort
|
|
41
|
+
* @param options - Sort options
|
|
42
|
+
* @returns A new object with keys sorted by length in descending order
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```javascript
|
|
46
|
+
* sortKeysLength.desc({ab: 'x', a: 'y', abc: 'z'});
|
|
47
|
+
* //=> {abc: 'z', ab: 'x', a: 'y'}
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function desc<T extends object>(object: T, options?: SortKeysLengthOptions): T;
|
|
51
|
+
|
|
52
|
+
export { asc, desc, SortKeysLengthOptions };
|
|
53
|
+
|
|
54
|
+
````
|
|
55
|
+
|
|
56
|
+
### Additional Details
|
|
57
|
+
* Last updated: Thu, 05 Feb 2026 08:45:22 GMT
|
|
58
|
+
* Dependencies: none
|
|
59
|
+
|
|
60
|
+
# Credits
|
|
61
|
+
These definitions were written by [gaspard](https://github.com/gasp).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for sorting object keys by length.
|
|
3
|
+
*/
|
|
4
|
+
interface SortKeysLengthOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Recursively sort keys.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
deep?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sort object keys by length in ascending order (shortest first).
|
|
14
|
+
*
|
|
15
|
+
* @param object - Object to sort
|
|
16
|
+
* @param options - Sort options
|
|
17
|
+
* @returns A new object with keys sorted by length in ascending order
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* sortKeysLength.asc({ab: 'x', a: 'y', abc: 'z'});
|
|
22
|
+
* //=> {a: 'y', ab: 'x', abc: 'z'}
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function asc<T extends object>(object: T, options?: SortKeysLengthOptions): T;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Sort object keys by length in descending order (longest first).
|
|
29
|
+
*
|
|
30
|
+
* @param object - Object to sort
|
|
31
|
+
* @param options - Sort options
|
|
32
|
+
* @returns A new object with keys sorted by length in descending order
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* sortKeysLength.desc({ab: 'x', a: 'y', abc: 'z'});
|
|
37
|
+
* //=> {abc: 'z', ab: 'x', a: 'y'}
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function desc<T extends object>(object: T, options?: SortKeysLengthOptions): T;
|
|
41
|
+
|
|
42
|
+
export { asc, desc, SortKeysLengthOptions };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/sort-keys-length",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "TypeScript definitions for sort-keys-length",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sort-keys-length",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "gaspard",
|
|
10
|
+
"githubUsername": "gasp",
|
|
11
|
+
"url": "https://github.com/gasp"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"main": "",
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
19
|
+
"directory": "types/sort-keys-length"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {},
|
|
22
|
+
"dependencies": {},
|
|
23
|
+
"peerDependencies": {},
|
|
24
|
+
"typesPublisherContentHash": "f4cf48704eeb1f111e0e769235161822e79d934198811e7b97910001d5d2e21f",
|
|
25
|
+
"typeScriptVersion": "5.2"
|
|
26
|
+
}
|