@poppinss/utils 6.5.0-8 → 6.5.1
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/README.md +2 -2
- package/build/{chunk-XHQBV7AF.js → chunk-IOBSMUFC.js} +1 -0
- package/build/chunk-IOBSMUFC.js.map +1 -0
- package/build/{chunk-OKRMWJO4.js → chunk-K76IL3UP.js} +2 -1
- package/build/chunk-K76IL3UP.js.map +1 -0
- package/build/{chunk-PWRXO3NF.js → chunk-NKGAOHNN.js} +1 -0
- package/build/chunk-NKGAOHNN.js.map +1 -0
- package/build/index.d.ts +19 -278
- package/build/index.js +3 -2
- package/build/index.js.map +1 -0
- package/build/lodash/main.cjs +32 -34
- package/build/src/assert.d.ts +3 -5
- package/build/src/assert.js +1 -0
- package/build/src/assert.js.map +1 -0
- package/build/src/base64.d.ts +33 -0
- package/build/src/compose.d.ts +19 -0
- package/build/src/define_static_property.d.ts +10 -0
- package/build/src/exception.d.ts +52 -0
- package/build/src/exceptions/invalid_arguments_exception.d.ts +5 -0
- package/build/src/exceptions/runtime_exception.d.ts +5 -0
- package/build/src/flatten.d.ts +4 -0
- package/build/src/fs_import_all.d.ts +20 -0
- package/build/src/fs_read_all.d.ts +20 -0
- package/build/src/import_default.d.ts +6 -0
- package/build/src/is_script_file.d.ts +5 -0
- package/build/src/json/main.d.ts +3 -15
- package/build/src/json/main.js +2 -1
- package/build/src/json/main.js.map +1 -0
- package/build/src/json/safe_parse.d.ts +5 -0
- package/build/src/json/safe_stringify.d.ts +6 -0
- package/build/src/message_builder.d.ts +17 -0
- package/build/src/natural_sort.d.ts +4 -0
- package/build/src/object_builder.d.ts +58 -0
- package/build/src/safe_equal.d.ts +11 -0
- package/build/src/slash.d.ts +1 -0
- package/build/src/string/bytes.d.ts +11 -0
- package/build/src/string/change_case.d.ts +42 -0
- package/build/src/string/excerpt.d.ts +11 -0
- package/build/src/string/interpolate.d.ts +8 -0
- package/build/src/string/main.d.ts +15 -118
- package/build/src/string/main.js +3 -2
- package/build/src/string/main.js.map +1 -0
- package/build/src/string/milliseconds.d.ts +9 -0
- package/build/src/string/ordinal.d.ts +4 -0
- package/build/src/string/pluralize.d.ts +16 -0
- package/build/src/string/random.d.ts +4 -0
- package/build/src/string/seconds.d.ts +9 -0
- package/build/src/string/sentence.d.ts +8 -0
- package/build/src/string/slugify.d.ts +6 -0
- package/build/src/string/truncate.d.ts +10 -0
- package/build/src/string_builder.d.ts +1 -3
- package/build/src/string_builder.js +3 -2
- package/build/src/string_builder.js.map +1 -0
- package/build/src/types.d.ts +11 -9
- package/build/src/types.js +1 -0
- package/build/src/types.js.map +1 -0
- package/package.json +21 -16
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The method is a copy/paste from the "title-case" package. They have
|
|
3
|
+
* a dependency on "tslib", which I don't want.
|
|
4
|
+
*/
|
|
5
|
+
export declare function titleCase(input: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Convert string to camelcase
|
|
8
|
+
*/
|
|
9
|
+
export declare function camelCase(value: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert string to snakecase
|
|
12
|
+
*/
|
|
13
|
+
export declare function snakeCase(value: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Convert string to dashcase
|
|
16
|
+
*/
|
|
17
|
+
export declare function dashCase(value: string, options?: {
|
|
18
|
+
capitalize?: boolean;
|
|
19
|
+
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* Convert string to pascal case
|
|
22
|
+
*/
|
|
23
|
+
export declare function pascalCase(value: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Convert string to capital case
|
|
26
|
+
*/
|
|
27
|
+
export declare function capitalCase(value: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Convert string to sentence case
|
|
30
|
+
*/
|
|
31
|
+
export declare function sentenceCase(value: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Convert string to dot case
|
|
34
|
+
*/
|
|
35
|
+
export declare function dotCase(value: string, options?: {
|
|
36
|
+
lowerCase?: boolean;
|
|
37
|
+
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* Remove all sort of casing from the string. Copy-pasted from
|
|
40
|
+
* "no-case" package with slight modifications.
|
|
41
|
+
*/
|
|
42
|
+
export declare function noCase(value: string, transform?: (part: string, index: number, parts: string[]) => string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncate a sentence to be under a certain characters limit and strip
|
|
3
|
+
* out HTML tags from it.
|
|
4
|
+
*
|
|
5
|
+
* Optionally, you can force the truncate logic to complete words, which
|
|
6
|
+
* may exceed the defined characters limit.
|
|
7
|
+
*/
|
|
8
|
+
export declare function excerpt(sentence: string, charactersLimit: number, options?: {
|
|
9
|
+
completeWords?: boolean;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
}): string;
|
|
@@ -1,113 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Truncate a sentence to be under a certain characters limit and strip
|
|
12
|
-
* out HTML tags from it.
|
|
13
|
-
*
|
|
14
|
-
* Optionally, you can force the truncate logic to complete words, which
|
|
15
|
-
* may exceed the defined characters limit.
|
|
16
|
-
*/
|
|
17
|
-
declare function excerpt(sentence: string, charactersLimit: number, options?: {
|
|
18
|
-
completeWords?: boolean;
|
|
19
|
-
suffix?: string;
|
|
20
|
-
}): string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Ordinalize a give number or string
|
|
24
|
-
*/
|
|
25
|
-
declare function ordinal(value: string | number): string;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Truncate a sentence to be under a certain characters limit.
|
|
29
|
-
*
|
|
30
|
-
* Optionally, you can force the truncate logic to complete words, which
|
|
31
|
-
* may exceed the defined characters limit.
|
|
32
|
-
*/
|
|
33
|
-
declare function truncate(sentence: string, charactersLimit: number, options?: {
|
|
34
|
-
completeWords?: boolean;
|
|
35
|
-
suffix?: string;
|
|
36
|
-
}): string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Convert an array of values to a sentence.
|
|
40
|
-
*/
|
|
41
|
-
declare function sentence(values: any[], options?: {
|
|
42
|
-
separator?: string;
|
|
43
|
-
pairSeparator?: string;
|
|
44
|
-
lastSeparator?: string;
|
|
45
|
-
}): string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* A simple function interpolate values inside curly braces.
|
|
49
|
-
*
|
|
50
|
-
* ```
|
|
51
|
-
* interpolate('hello {{ username }}', { username: 'virk' })
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function interpolate(input: string, data: any): string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Pluralize a word based upon the count. The method returns the
|
|
58
|
-
* singular form when count is 1.
|
|
59
|
-
*/
|
|
60
|
-
declare function pluralize(word: string, count?: number, inclusive?: boolean): string;
|
|
61
|
-
declare namespace pluralize {
|
|
62
|
-
var addPluralRule: typeof pluralizePkg.addPluralRule;
|
|
63
|
-
var addSingularRule: typeof pluralizePkg.addSingularRule;
|
|
64
|
-
var addIrregularRule: typeof pluralizePkg.addIrregularRule;
|
|
65
|
-
var addUncountableRule: typeof pluralizePkg.addUncountableRule;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The method is a copy/paste from the "title-case" package. They have
|
|
70
|
-
* a dependency on "tslib", which I don't want.
|
|
71
|
-
*/
|
|
72
|
-
declare function titleCase(input: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Convert string to camelcase
|
|
75
|
-
*/
|
|
76
|
-
declare function camelCase(value: string): string;
|
|
77
|
-
/**
|
|
78
|
-
* Convert string to snakecase
|
|
79
|
-
*/
|
|
80
|
-
declare function snakeCase(value: string): string;
|
|
81
|
-
/**
|
|
82
|
-
* Convert string to dashcase
|
|
83
|
-
*/
|
|
84
|
-
declare function dashCase(value: string, options?: {
|
|
85
|
-
capitalize?: boolean;
|
|
86
|
-
}): string;
|
|
87
|
-
/**
|
|
88
|
-
* Convert string to pascal case
|
|
89
|
-
*/
|
|
90
|
-
declare function pascalCase(value: string): string;
|
|
91
|
-
/**
|
|
92
|
-
* Convert string to capital case
|
|
93
|
-
*/
|
|
94
|
-
declare function capitalCase(value: string): string;
|
|
95
|
-
/**
|
|
96
|
-
* Convert string to sentence case
|
|
97
|
-
*/
|
|
98
|
-
declare function sentenceCase(value: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Convert string to dot case
|
|
101
|
-
*/
|
|
102
|
-
declare function dotCase(value: string, options?: {
|
|
103
|
-
lowerCase?: boolean;
|
|
104
|
-
}): string;
|
|
105
|
-
/**
|
|
106
|
-
* Remove all sort of casing from the string. Copy-pasted from
|
|
107
|
-
* "no-case" package with slight modifications.
|
|
108
|
-
*/
|
|
109
|
-
declare function noCase(value: string, transform?: (part: string, index: number, parts: string[]) => string): string;
|
|
110
|
-
|
|
1
|
+
import { random } from './random.js';
|
|
2
|
+
import { excerpt } from './excerpt.js';
|
|
3
|
+
import { ordinal } from './ordinal.js';
|
|
4
|
+
import { truncate } from './truncate.js';
|
|
5
|
+
import { sentence } from './sentence.js';
|
|
6
|
+
import { interpolate } from './interpolate.js';
|
|
7
|
+
import { pluralize } from './pluralize.js';
|
|
8
|
+
import { noCase, dotCase, dashCase, camelCase, snakeCase, titleCase, pascalCase, capitalCase, sentenceCase } from './change_case.js';
|
|
111
9
|
/**
|
|
112
10
|
* Condense multiple whitespaces from a string
|
|
113
11
|
*/
|
|
@@ -115,13 +13,13 @@ declare function condenseWhitespace(value: string): string;
|
|
|
115
13
|
declare const string: {
|
|
116
14
|
excerpt: typeof excerpt;
|
|
117
15
|
truncate: typeof truncate;
|
|
118
|
-
slug: typeof slugify.default;
|
|
16
|
+
slug: typeof import("slugify").default;
|
|
119
17
|
interpolate: typeof interpolate;
|
|
120
|
-
plural: typeof pluralize.plural;
|
|
18
|
+
plural: typeof import("pluralize").plural;
|
|
121
19
|
pluralize: typeof pluralize;
|
|
122
|
-
singular: typeof pluralize.singular;
|
|
123
|
-
isPlural: typeof pluralize.isPlural;
|
|
124
|
-
isSingular: typeof pluralize.isSingular;
|
|
20
|
+
singular: typeof import("pluralize").singular;
|
|
21
|
+
isPlural: typeof import("pluralize").isPlural;
|
|
22
|
+
isSingular: typeof import("pluralize").isSingular;
|
|
125
23
|
camelCase: typeof camelCase;
|
|
126
24
|
capitalCase: typeof capitalCase;
|
|
127
25
|
dashCase: typeof dashCase;
|
|
@@ -143,10 +41,9 @@ declare const string: {
|
|
|
143
41
|
parse(duration: string | number): number;
|
|
144
42
|
};
|
|
145
43
|
bytes: {
|
|
146
|
-
format(valueInBytes: number, options?: bytes.BytesOptions | undefined): string;
|
|
44
|
+
format(valueInBytes: number, options?: import("bytes").BytesOptions | undefined): string;
|
|
147
45
|
parse(unit: string | number): number;
|
|
148
46
|
};
|
|
149
47
|
ordinal: typeof ordinal;
|
|
150
48
|
};
|
|
151
|
-
|
|
152
|
-
export { string as default };
|
|
49
|
+
export default string;
|
package/build/src/string/main.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
format(milliseconds: number, long?: boolean): string;
|
|
3
|
+
/**
|
|
4
|
+
* Parse time expression string to milliseconds. The number value
|
|
5
|
+
* is returned as it is, considering it is already in milliseconds
|
|
6
|
+
*/
|
|
7
|
+
parse(duration: string | number): number;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as pluralizePkg } from 'pluralize';
|
|
2
|
+
/**
|
|
3
|
+
* Pluralize a word based upon the count. The method returns the
|
|
4
|
+
* singular form when count is 1.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pluralize(word: string, count?: number, inclusive?: boolean): string;
|
|
7
|
+
export declare namespace pluralize {
|
|
8
|
+
var addPluralRule: typeof pluralizePkg.addPluralRule;
|
|
9
|
+
var addSingularRule: typeof pluralizePkg.addSingularRule;
|
|
10
|
+
var addIrregularRule: typeof pluralizePkg.addIrregularRule;
|
|
11
|
+
var addUncountableRule: typeof pluralizePkg.addUncountableRule;
|
|
12
|
+
}
|
|
13
|
+
export declare const plural: typeof pluralizePkg.plural;
|
|
14
|
+
export declare const singular: typeof pluralizePkg.singular;
|
|
15
|
+
export declare const isPlural: typeof pluralizePkg.isPlural;
|
|
16
|
+
export declare const isSingular: typeof pluralizePkg.isSingular;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
format(seconds: number, long?: boolean): string;
|
|
3
|
+
/**
|
|
4
|
+
* Parse time expression string to seconds. The number value
|
|
5
|
+
* is returned as it is, considering it is already in seconds
|
|
6
|
+
*/
|
|
7
|
+
parse(duration: string | number): number;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncate a sentence to be under a certain characters limit.
|
|
3
|
+
*
|
|
4
|
+
* Optionally, you can force the truncate logic to complete words, which
|
|
5
|
+
* may exceed the defined characters limit.
|
|
6
|
+
*/
|
|
7
|
+
export declare function truncate(sentence: string, charactersLimit: number, options?: {
|
|
8
|
+
completeWords?: boolean;
|
|
9
|
+
suffix?: string;
|
|
10
|
+
}): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* String builder to transform the string using the fluent API
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
export default class StringBuilder {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(value: string | StringBuilder);
|
|
7
7
|
/**
|
|
@@ -78,5 +78,3 @@ declare class StringBuilder {
|
|
|
78
78
|
ext(extension: string): this;
|
|
79
79
|
toString(): string;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
export { StringBuilder as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
main_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-K76IL3UP.js";
|
|
4
|
+
import "../chunk-NKGAOHNN.js";
|
|
5
5
|
|
|
6
6
|
// src/string_builder.ts
|
|
7
7
|
import { extname } from "node:path";
|
|
@@ -146,3 +146,4 @@ var StringBuilder = class {
|
|
|
146
146
|
export {
|
|
147
147
|
StringBuilder as default
|
|
148
148
|
};
|
|
149
|
+
//# sourceMappingURL=string_builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/string_builder.ts"],"sourcesContent":["/*\n * @poppinss/utils\n *\n * (c) Poppinss\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { extname } from 'node:path'\nimport string from './string/main.js'\n\n/**\n * String builder to transform the string using the fluent API\n */\nexport default class StringBuilder {\n #value: string\n\n constructor(value: string | StringBuilder) {\n this.#value = typeof value === 'string' ? value : value.toString()\n }\n\n /**\n * Applies dash case transformation\n */\n dashCase(): this {\n this.#value = string.dashCase(this.#value)\n return this\n }\n\n /**\n * Applies dot case transformation\n */\n dotCase(): this {\n this.#value = string.dotCase(this.#value)\n return this\n }\n\n /**\n * Applies snake case transformation\n */\n snakeCase(): this {\n this.#value = string.snakeCase(this.#value)\n return this\n }\n\n /**\n * Applies pascal case transformation\n */\n pascalCase(): this {\n this.#value = string.pascalCase(this.#value)\n return this\n }\n\n /**\n * Applies camelcase case transformation\n */\n camelCase(): this {\n this.#value = string.camelCase(this.#value)\n return this\n }\n\n /**\n * Applies capital case transformation\n */\n capitalCase(): this {\n this.#value = string.capitalCase(this.#value)\n return this\n }\n\n /**\n * Applies title case transformation\n */\n titleCase(): this {\n this.#value = string.titleCase(this.#value)\n return this\n }\n\n /**\n * Applies sentence case transformation\n */\n sentenceCase(): this {\n this.#value = string.sentenceCase(this.#value)\n return this\n }\n\n /**\n * Removes all sorts of casing from the string\n */\n noCase(): this {\n this.#value = string.noCase(this.#value)\n return this\n }\n\n /**\n * Converts value to its plural form\n */\n plural(): this {\n this.#value = string.pluralize(this.#value)\n return this\n }\n\n /**\n * Converts value to its singular form\n */\n singular(): this {\n this.#value = string.singular(this.#value)\n return this\n }\n\n /**\n * Converts value to a URL friendly slug\n */\n slugify(): this {\n this.#value = string.slug(this.#value)\n return this\n }\n\n /**\n * Removes a given suffix from the string\n */\n removeSuffix(suffix: string): this {\n this.#value = this.#value.replace(new RegExp(`[-_]?${suffix}$`, 'i'), '')\n return this\n }\n\n /**\n * Adds suffix to the string\n */\n suffix(suffix: string): this {\n this.removeSuffix(suffix)\n this.#value = `${this.#value}${suffix}`\n return this\n }\n\n /**\n * Removes a given prefix from the string\n */\n removePrefix(prefix: string): this {\n this.#value = this.#value.replace(new RegExp(`^${prefix}[-_]?`, 'i'), '')\n return this\n }\n\n /**\n * Adds prefix to the string\n */\n prefix(prefix: string): this {\n this.removePrefix(prefix)\n this.#value = `${prefix}${this.#value}`\n return this\n }\n\n /**\n * Removes extension from the value\n */\n removeExtension(): this {\n this.#value = this.#value.replace(new RegExp(`${extname(this.#value)}$`), '')\n return this\n }\n\n /**\n * Adds extension to the value\n */\n ext(extension: string): this {\n this.removeExtension()\n this.#value = `${this.#value}.${extension.replace(/^\\./, '')}`\n return this\n }\n\n toString() {\n return this.#value\n }\n}\n"],"mappings":";;;;;;AASA,SAAS,eAAe;AAMxB,IAAqB,gBAArB,MAAmC;AAAA,EACjC;AAAA,EAEA,YAAY,OAA+B;AACzC,SAAK,SAAS,OAAO,UAAU,WAAW,QAAQ,MAAM,SAAS;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA,EAKA,WAAiB;AACf,SAAK,SAAS,aAAO,SAAS,KAAK,MAAM;AACzC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,UAAgB;AACd,SAAK,SAAS,aAAO,QAAQ,KAAK,MAAM;AACxC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,YAAkB;AAChB,SAAK,SAAS,aAAO,UAAU,KAAK,MAAM;AAC1C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,aAAmB;AACjB,SAAK,SAAS,aAAO,WAAW,KAAK,MAAM;AAC3C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,YAAkB;AAChB,SAAK,SAAS,aAAO,UAAU,KAAK,MAAM;AAC1C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,cAAoB;AAClB,SAAK,SAAS,aAAO,YAAY,KAAK,MAAM;AAC5C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,YAAkB;AAChB,SAAK,SAAS,aAAO,UAAU,KAAK,MAAM;AAC1C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,eAAqB;AACnB,SAAK,SAAS,aAAO,aAAa,KAAK,MAAM;AAC7C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,SAAe;AACb,SAAK,SAAS,aAAO,OAAO,KAAK,MAAM;AACvC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,SAAe;AACb,SAAK,SAAS,aAAO,UAAU,KAAK,MAAM;AAC1C,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,WAAiB;AACf,SAAK,SAAS,aAAO,SAAS,KAAK,MAAM;AACzC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,UAAgB;AACd,SAAK,SAAS,aAAO,KAAK,KAAK,MAAM;AACrC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,aAAa,QAAsB;AACjC,SAAK,SAAS,KAAK,OAAO,QAAQ,IAAI,OAAO,QAAQ,MAAM,KAAK,GAAG,GAAG,EAAE;AACxE,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,QAAsB;AAC3B,SAAK,aAAa,MAAM;AACxB,SAAK,SAAS,GAAG,KAAK,MAAM,GAAG,MAAM;AACrC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,aAAa,QAAsB;AACjC,SAAK,SAAS,KAAK,OAAO,QAAQ,IAAI,OAAO,IAAI,MAAM,SAAS,GAAG,GAAG,EAAE;AACxE,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,QAAsB;AAC3B,SAAK,aAAa,MAAM;AACxB,SAAK,SAAS,GAAG,MAAM,GAAG,KAAK,MAAM;AACrC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAwB;AACtB,SAAK,SAAS,KAAK,OAAO,QAAQ,IAAI,OAAO,GAAG,QAAQ,KAAK,MAAM,CAAC,GAAG,GAAG,EAAE;AAC5E,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,WAAyB;AAC3B,SAAK,gBAAgB;AACrB,SAAK,SAAS,GAAG,KAAK,MAAM,IAAI,UAAU,QAAQ,OAAO,EAAE,CAAC;AAC5D,WAAO;AAAA,EACT;AAAA,EAEA,WAAW;AACT,WAAO,KAAK;AAAA,EACd;AACF;","names":[]}
|
package/build/src/types.d.ts
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
type PickKeysByValue<T, V> = {
|
|
2
2
|
[K in keyof T]: T[K] extends V ? K : never;
|
|
3
3
|
}[keyof T];
|
|
4
|
-
type OmitProperties<T, P> = Omit<T, PickKeysByValue<T, P>>;
|
|
4
|
+
export type OmitProperties<T, P> = Omit<T, PickKeysByValue<T, P>>;
|
|
5
5
|
type ScanFsBaseOptions = {
|
|
6
6
|
ignoreMissingRoot?: boolean;
|
|
7
7
|
filter?: (filePath: string, index: number) => boolean;
|
|
8
8
|
sort?: (current: string, next: string) => number;
|
|
9
9
|
};
|
|
10
|
-
type ImportAllFilesOptions = ScanFsBaseOptions & {
|
|
10
|
+
export type ImportAllFilesOptions = ScanFsBaseOptions & {
|
|
11
11
|
/**
|
|
12
12
|
* A custom method to transform collection keys
|
|
13
13
|
*/
|
|
14
14
|
transformKeys?: (keys: string[]) => string[];
|
|
15
15
|
};
|
|
16
|
-
type ReadAllFilesOptions = ScanFsBaseOptions & {
|
|
16
|
+
export type ReadAllFilesOptions = ScanFsBaseOptions & {
|
|
17
17
|
pathType?: 'relative' | 'unixRelative' | 'absolute' | 'unixAbsolute' | 'url';
|
|
18
18
|
};
|
|
19
|
-
type JSONReplacer = (this: any, key: string, value: any) => any;
|
|
20
|
-
type JSONReviver = (this: any, key: string, value: any) => any;
|
|
21
|
-
type Constructor = new (...args: any[]) => any;
|
|
19
|
+
export type JSONReplacer = (this: any, key: string, value: any) => any;
|
|
20
|
+
export type JSONReviver = (this: any, key: string, value: any) => any;
|
|
21
|
+
export type Constructor = new (...args: any[]) => any;
|
|
22
22
|
/**
|
|
23
23
|
* Normalizes constructor to work with mixins. There is an open bug for mixins
|
|
24
24
|
* to allow constructors other than `...args: any[]`
|
|
25
25
|
*
|
|
26
26
|
* https://github.com/microsoft/TypeScript/issues/37142
|
|
27
27
|
*/
|
|
28
|
-
type NormalizeConstructor<T extends Constructor> = {
|
|
28
|
+
export type NormalizeConstructor<T extends Constructor> = {
|
|
29
29
|
new (...args: any[]): InstanceType<T>;
|
|
30
30
|
} & Omit<T, 'constructor'>;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
export type Opaque<T, K> = T & {
|
|
32
|
+
[' __opaque__']: K;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
package/build/src/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poppinss/utils",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.1",
|
|
4
4
|
"description": "Handy utilities for repetitive work",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"build",
|
|
9
|
+
"!build/tests",
|
|
10
|
+
"!build/test_helpers",
|
|
11
|
+
"!build/bin",
|
|
9
12
|
"lodash"
|
|
10
13
|
],
|
|
11
14
|
"exports": {
|
|
@@ -30,7 +33,8 @@
|
|
|
30
33
|
"quick:test": "node --loader=ts-node/esm bin/test.ts",
|
|
31
34
|
"clean": "del-cli build",
|
|
32
35
|
"typecheck": "tsc --noEmit",
|
|
33
|
-
"
|
|
36
|
+
"precompile": "npm run lint && npm run clean",
|
|
37
|
+
"compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
|
|
34
38
|
"build": "npm run compile && npm run build:lodash",
|
|
35
39
|
"release": "np",
|
|
36
40
|
"version": "npm run build",
|
|
@@ -49,17 +53,17 @@
|
|
|
49
53
|
"@adonisjs/eslint-config": "^1.1.6",
|
|
50
54
|
"@adonisjs/prettier-config": "^1.1.6",
|
|
51
55
|
"@adonisjs/tsconfig": "^1.1.6",
|
|
52
|
-
"@commitlint/cli": "^
|
|
53
|
-
"@commitlint/config-conventional": "^
|
|
54
|
-
"@japa/assert": "^2.0.0
|
|
55
|
-
"@japa/expect-type": "^2.0.0
|
|
56
|
-
"@japa/runner": "^3.0.
|
|
57
|
-
"@swc/core": "1.3.
|
|
58
|
-
"@types/fs-extra": "^11.0.
|
|
59
|
-
"@types/node": "^20.
|
|
56
|
+
"@commitlint/cli": "^18.2.0",
|
|
57
|
+
"@commitlint/config-conventional": "^18.1.0",
|
|
58
|
+
"@japa/assert": "^2.0.0",
|
|
59
|
+
"@japa/expect-type": "^2.0.0",
|
|
60
|
+
"@japa/runner": "^3.0.4",
|
|
61
|
+
"@swc/core": "^1.3.96",
|
|
62
|
+
"@types/fs-extra": "^11.0.3",
|
|
63
|
+
"@types/node": "^20.8.10",
|
|
60
64
|
"c8": "^8.0.0",
|
|
61
65
|
"del-cli": "^5.1.0",
|
|
62
|
-
"eslint": "^8.
|
|
66
|
+
"eslint": "^8.53.0",
|
|
63
67
|
"fs-extra": "^11.1.1",
|
|
64
68
|
"github-label-sync": "^2.3.1",
|
|
65
69
|
"husky": "^8.0.3",
|
|
@@ -74,8 +78,8 @@
|
|
|
74
78
|
},
|
|
75
79
|
"dependencies": {
|
|
76
80
|
"@lukeed/ms": "^2.0.1",
|
|
77
|
-
"@types/bytes": "^3.1.
|
|
78
|
-
"@types/pluralize": "0.0.
|
|
81
|
+
"@types/bytes": "^3.1.3",
|
|
82
|
+
"@types/pluralize": "^0.0.32",
|
|
79
83
|
"bytes": "^3.1.2",
|
|
80
84
|
"case-anything": "^2.1.13",
|
|
81
85
|
"flattie": "^1.1.0",
|
|
@@ -112,11 +116,11 @@
|
|
|
112
116
|
},
|
|
113
117
|
"publishConfig": {
|
|
114
118
|
"access": "public",
|
|
115
|
-
"tag": "
|
|
119
|
+
"tag": "latest"
|
|
116
120
|
},
|
|
117
121
|
"np": {
|
|
118
122
|
"message": "chore(release): %s",
|
|
119
|
-
"tag": "
|
|
123
|
+
"tag": "latest",
|
|
120
124
|
"branch": "main",
|
|
121
125
|
"anyBranch": false
|
|
122
126
|
},
|
|
@@ -136,7 +140,8 @@
|
|
|
136
140
|
"outDir": "./build",
|
|
137
141
|
"clean": true,
|
|
138
142
|
"format": "esm",
|
|
139
|
-
"dts":
|
|
143
|
+
"dts": false,
|
|
144
|
+
"sourcemap": true,
|
|
140
145
|
"target": "esnext"
|
|
141
146
|
}
|
|
142
147
|
}
|