@poppinss/utils 6.8.3 → 6.9.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.
- package/README.md +1 -1
- package/build/chunk-2KG3PWR4.js +17 -0
- package/build/chunk-4V5ON6P7.js +7 -0
- package/build/chunk-EJKUJ44Y.js +12 -0
- package/build/chunk-H54AK3PI.js +7 -0
- package/build/{chunk-IOBSMUFC.js → chunk-XHQBV7AF.js} +0 -1
- package/build/index.d.ts +1 -2
- package/build/index.js +67 -68
- package/build/src/assert.js +2 -1
- package/build/src/base64.d.ts +2 -2
- package/build/src/exception.d.ts +1 -52
- package/build/src/exception.js +2 -2
- package/build/src/exceptions/main.d.ts +1 -2
- package/build/src/exceptions/main.js +2 -3
- package/build/src/json/main.js +2 -2
- package/build/src/object_builder.d.ts +1 -58
- package/build/src/slash.d.ts +24 -1
- package/build/src/slash.js +4 -4
- package/build/src/string/main.d.ts +1 -49
- package/build/src/string/main.js +2 -8
- package/build/src/string/string_builder.d.ts +1 -0
- package/build/src/string/string_builder.js +2 -0
- package/build/src/types.js +0 -1
- package/package.json +21 -26
- package/build/chunk-GGIWJLUJ.js +0 -55
- package/build/chunk-GGIWJLUJ.js.map +0 -1
- package/build/chunk-IOBSMUFC.js.map +0 -1
- package/build/chunk-K76IL3UP.js +0 -270
- package/build/chunk-K76IL3UP.js.map +0 -1
- package/build/chunk-NKGAOHNN.js +0 -64
- package/build/chunk-NKGAOHNN.js.map +0 -1
- package/build/chunk-PNT36FCE.js +0 -21
- package/build/chunk-PNT36FCE.js.map +0 -1
- package/build/chunk-RRTFLKKC.js +0 -7
- package/build/chunk-RRTFLKKC.js.map +0 -1
- package/build/index.js.map +0 -1
- package/build/src/assert.js.map +0 -1
- package/build/src/exception.js.map +0 -1
- package/build/src/exceptions/invalid_arguments_exception.d.ts +0 -5
- package/build/src/exceptions/main.js.map +0 -1
- package/build/src/exceptions/runtime_exception.d.ts +0 -5
- package/build/src/json/main.js.map +0 -1
- package/build/src/slash.js.map +0 -1
- package/build/src/string/bytes.d.ts +0 -11
- package/build/src/string/change_case.d.ts +0 -42
- package/build/src/string/excerpt.d.ts +0 -11
- package/build/src/string/interpolate.d.ts +0 -8
- package/build/src/string/main.js.map +0 -1
- package/build/src/string/milliseconds.d.ts +0 -9
- package/build/src/string/ordinal.d.ts +0 -4
- package/build/src/string/pluralize.d.ts +0 -16
- package/build/src/string/random.d.ts +0 -4
- package/build/src/string/seconds.d.ts +0 -9
- package/build/src/string/sentence.d.ts +0 -8
- package/build/src/string/slugify.d.ts +0 -6
- package/build/src/string/truncate.d.ts +0 -10
- package/build/src/string_builder.d.ts +0 -80
- package/build/src/string_builder.js +0 -149
- package/build/src/string_builder.js.map +0 -1
- package/build/src/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1053,7 +1053,7 @@ if (safeEqual(trustedValue, userInput)) {
|
|
|
1053
1053
|
|
|
1054
1054
|
#### slash
|
|
1055
1055
|
|
|
1056
|
-
Convert OS-specific file paths to Unix file paths.
|
|
1056
|
+
Convert OS-specific file paths to Unix file paths. Credits [https://github.com/sindresorhus/slash](https://github.com/sindresorhus/slash)
|
|
1057
1057
|
|
|
1058
1058
|
```ts
|
|
1059
1059
|
import { slash } from '@poppinss/utils/slash'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
__reExport
|
|
17
|
+
};
|
package/build/index.d.ts
CHANGED
|
@@ -13,8 +13,7 @@ export { naturalSort } from './src/natural_sort.js';
|
|
|
13
13
|
export { ObjectBuilder } from './src/object_builder.js';
|
|
14
14
|
export { safeEqual } from './src/safe_equal.js';
|
|
15
15
|
export { slash } from './src/slash.js';
|
|
16
|
-
export { RuntimeException } from './src/exceptions/
|
|
17
|
-
export { InvalidArgumentsException } from './src/exceptions/invalid_arguments_exception.js';
|
|
16
|
+
export { RuntimeException, InvalidArgumentsException } from './src/exceptions/main.js';
|
|
18
17
|
/**
|
|
19
18
|
* Get dirname for a given file path URL
|
|
20
19
|
*/
|
package/build/index.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Exception,
|
|
3
|
+
createError
|
|
4
|
+
} from "./chunk-H54AK3PI.js";
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-NKGAOHNN.js";
|
|
6
|
+
slash
|
|
7
|
+
} from "./chunk-EJKUJ44Y.js";
|
|
8
8
|
import {
|
|
9
9
|
InvalidArgumentsException,
|
|
10
10
|
RuntimeException
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
Exception,
|
|
14
|
-
createError
|
|
15
|
-
} from "./chunk-GGIWJLUJ.js";
|
|
11
|
+
} from "./chunk-4V5ON6P7.js";
|
|
16
12
|
import {
|
|
17
13
|
main_default
|
|
18
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XHQBV7AF.js";
|
|
15
|
+
import {
|
|
16
|
+
__reExport
|
|
17
|
+
} from "./chunk-2KG3PWR4.js";
|
|
19
18
|
|
|
20
19
|
// index.ts
|
|
21
20
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -61,6 +60,46 @@ var Secret = class _Secret {
|
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
62
|
|
|
63
|
+
// src/base64.ts
|
|
64
|
+
var Base64 = class {
|
|
65
|
+
encode(data, encoding) {
|
|
66
|
+
if (typeof data === "string") {
|
|
67
|
+
return Buffer.from(data, encoding).toString("base64");
|
|
68
|
+
}
|
|
69
|
+
if (Buffer.isBuffer(data)) {
|
|
70
|
+
return data.toString("base64");
|
|
71
|
+
}
|
|
72
|
+
return Buffer.from(data).toString("base64");
|
|
73
|
+
}
|
|
74
|
+
decode(encoded, encoding = "utf-8", strict = false) {
|
|
75
|
+
if (Buffer.isBuffer(encoded)) {
|
|
76
|
+
return encoded.toString(encoding);
|
|
77
|
+
}
|
|
78
|
+
const decoded = Buffer.from(encoded, "base64").toString(encoding);
|
|
79
|
+
const isInvalid = this.encode(decoded, encoding) !== encoded;
|
|
80
|
+
if (strict && isInvalid) {
|
|
81
|
+
throw new Error("Cannot decode malformed value");
|
|
82
|
+
}
|
|
83
|
+
return isInvalid ? null : decoded;
|
|
84
|
+
}
|
|
85
|
+
urlEncode(data, encoding) {
|
|
86
|
+
const encoded = typeof data === "string" ? this.encode(data, encoding) : this.encode(data);
|
|
87
|
+
return encoded.replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, "");
|
|
88
|
+
}
|
|
89
|
+
urlDecode(encoded, encoding = "utf-8", strict = false) {
|
|
90
|
+
if (Buffer.isBuffer(encoded)) {
|
|
91
|
+
return encoded.toString(encoding);
|
|
92
|
+
}
|
|
93
|
+
const decoded = Buffer.from(encoded, "base64").toString(encoding);
|
|
94
|
+
const isInvalid = this.urlEncode(decoded, encoding) !== encoded;
|
|
95
|
+
if (strict && isInvalid) {
|
|
96
|
+
throw new Error("Cannot urlDecode malformed value");
|
|
97
|
+
}
|
|
98
|
+
return isInvalid ? null : decoded;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var base64 = new Base64();
|
|
102
|
+
|
|
64
103
|
// src/compose.ts
|
|
65
104
|
function compose(superclass, ...mixins) {
|
|
66
105
|
return mixins.reduce((c, mixin) => mixin(c), superclass);
|
|
@@ -152,10 +191,10 @@ async function readFiles(root, files, options, relativePath) {
|
|
|
152
191
|
files.push(location);
|
|
153
192
|
break;
|
|
154
193
|
case "unixRelative":
|
|
155
|
-
files.push(
|
|
194
|
+
files.push(slash(relativePath));
|
|
156
195
|
break;
|
|
157
196
|
case "unixAbsolute":
|
|
158
|
-
files.push(
|
|
197
|
+
files.push(slash(location));
|
|
159
198
|
break;
|
|
160
199
|
case "url":
|
|
161
200
|
files.push(pathToFileURL(location).href);
|
|
@@ -220,12 +259,13 @@ async function fsImportAll(location, options) {
|
|
|
220
259
|
}
|
|
221
260
|
|
|
222
261
|
// src/message_builder.ts
|
|
262
|
+
import string from "@poppinss/string";
|
|
223
263
|
var MessageBuilder = class {
|
|
224
264
|
#getExpiryDate(expiresIn) {
|
|
225
265
|
if (!expiresIn) {
|
|
226
266
|
return void 0;
|
|
227
267
|
}
|
|
228
|
-
const expiryMs =
|
|
268
|
+
const expiryMs = string.milliseconds.parse(expiresIn);
|
|
229
269
|
return new Date(Date.now() + expiryMs);
|
|
230
270
|
}
|
|
231
271
|
/**
|
|
@@ -267,66 +307,25 @@ var MessageBuilder = class {
|
|
|
267
307
|
};
|
|
268
308
|
|
|
269
309
|
// src/object_builder.ts
|
|
270
|
-
var
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
constructor(initialValue, ignoreNull) {
|
|
274
|
-
this.values = initialValue;
|
|
275
|
-
this.#ignoreNull = ignoreNull === true ? true : false;
|
|
276
|
-
}
|
|
277
|
-
add(key, value) {
|
|
278
|
-
if (value === void 0) {
|
|
279
|
-
return this;
|
|
280
|
-
}
|
|
281
|
-
if (this.#ignoreNull === true && value === null) {
|
|
282
|
-
return this;
|
|
283
|
-
}
|
|
284
|
-
;
|
|
285
|
-
this.values[key] = value;
|
|
286
|
-
return this;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Remove key from the object
|
|
290
|
-
*/
|
|
291
|
-
remove(key) {
|
|
292
|
-
delete this.values[key];
|
|
293
|
-
return this;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Find if a value exists
|
|
297
|
-
*/
|
|
298
|
-
has(key) {
|
|
299
|
-
return this.get(key) !== void 0;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Get the existing value for a given key
|
|
303
|
-
*/
|
|
304
|
-
get(key) {
|
|
305
|
-
return this.values[key];
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Get the underlying constructed object
|
|
309
|
-
*/
|
|
310
|
-
toObject() {
|
|
311
|
-
return this.values;
|
|
312
|
-
}
|
|
313
|
-
};
|
|
310
|
+
var object_builder_exports = {};
|
|
311
|
+
__reExport(object_builder_exports, object_builder_star);
|
|
312
|
+
import * as object_builder_star from "@poppinss/object-builder";
|
|
314
313
|
|
|
315
314
|
// src/safe_equal.ts
|
|
316
|
-
import { Buffer } from "node:buffer";
|
|
315
|
+
import { Buffer as Buffer2 } from "node:buffer";
|
|
317
316
|
import { timingSafeEqual } from "node:crypto";
|
|
318
317
|
function safeEqual(trustedValue, userInput) {
|
|
319
318
|
if (typeof trustedValue === "string" && typeof userInput === "string") {
|
|
320
|
-
const trustedLength =
|
|
321
|
-
const trustedValueBuffer =
|
|
319
|
+
const trustedLength = Buffer2.byteLength(trustedValue);
|
|
320
|
+
const trustedValueBuffer = Buffer2.alloc(trustedLength, 0, "utf-8");
|
|
322
321
|
trustedValueBuffer.write(trustedValue);
|
|
323
|
-
const userValueBuffer =
|
|
322
|
+
const userValueBuffer = Buffer2.alloc(trustedLength, 0, "utf-8");
|
|
324
323
|
userValueBuffer.write(userInput);
|
|
325
|
-
return timingSafeEqual(trustedValueBuffer, userValueBuffer) && trustedLength ===
|
|
324
|
+
return timingSafeEqual(trustedValueBuffer, userValueBuffer) && trustedLength === Buffer2.byteLength(userInput);
|
|
326
325
|
}
|
|
327
326
|
return timingSafeEqual(
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
Buffer2.from(trustedValue),
|
|
328
|
+
Buffer2.from(userInput)
|
|
330
329
|
);
|
|
331
330
|
}
|
|
332
331
|
|
|
@@ -340,11 +339,12 @@ function getFilename(url) {
|
|
|
340
339
|
function joinToURL(url, ...str) {
|
|
341
340
|
return pathJoin(getDirname(url), ...str);
|
|
342
341
|
}
|
|
342
|
+
var export_ObjectBuilder = object_builder_exports.ObjectBuilder;
|
|
343
343
|
export {
|
|
344
344
|
Exception,
|
|
345
345
|
InvalidArgumentsException,
|
|
346
346
|
MessageBuilder,
|
|
347
|
-
ObjectBuilder,
|
|
347
|
+
export_ObjectBuilder as ObjectBuilder,
|
|
348
348
|
RuntimeException,
|
|
349
349
|
Secret,
|
|
350
350
|
base64,
|
|
@@ -361,6 +361,5 @@ export {
|
|
|
361
361
|
joinToURL,
|
|
362
362
|
naturalSort,
|
|
363
363
|
safeEqual,
|
|
364
|
-
|
|
364
|
+
slash
|
|
365
365
|
};
|
|
366
|
-
//# sourceMappingURL=index.js.map
|
package/build/src/assert.js
CHANGED
package/build/src/base64.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare class Base64 {
|
|
|
6
6
|
/**
|
|
7
7
|
* Base64 encode Buffer or string
|
|
8
8
|
*/
|
|
9
|
-
encode(arrayBuffer: ArrayBuffer | SharedArrayBuffer): string;
|
|
9
|
+
encode(arrayBuffer: ArrayBuffer | Buffer<ArrayBuffer> | SharedArrayBuffer): string;
|
|
10
10
|
encode(data: string, encoding?: BufferEncoding): string;
|
|
11
11
|
/**
|
|
12
12
|
* Base64 decode a previously encoded string or Buffer.
|
|
@@ -18,7 +18,7 @@ declare class Base64 {
|
|
|
18
18
|
/**
|
|
19
19
|
* Base64 encode Buffer or string to be URL safe. (RFC 4648)
|
|
20
20
|
*/
|
|
21
|
-
urlEncode(arrayBuffer: ArrayBuffer | SharedArrayBuffer): string;
|
|
21
|
+
urlEncode(arrayBuffer: ArrayBuffer | Buffer<ArrayBuffer> | SharedArrayBuffer): string;
|
|
22
22
|
urlEncode(data: string, encoding?: BufferEncoding): string;
|
|
23
23
|
/**
|
|
24
24
|
* Base64 URL decode a previously encoded string or Buffer. (RFC 4648)
|
package/build/src/exception.d.ts
CHANGED
|
@@ -1,52 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Extended Error object with the option to set error `status` and `code`.
|
|
3
|
-
* At AdonisJs, we prefer exceptions with proper error codes to handle
|
|
4
|
-
* them without relying on message pattern matching.
|
|
5
|
-
*
|
|
6
|
-
* ```js
|
|
7
|
-
* new Exception('message', 500, 'E_RUNTIME_EXCEPTION')
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
10
|
-
export declare class Exception extends Error {
|
|
11
|
-
/**
|
|
12
|
-
* Static properties to defined on the exception once
|
|
13
|
-
* and then re-use them
|
|
14
|
-
*/
|
|
15
|
-
static help?: string;
|
|
16
|
-
static code?: string;
|
|
17
|
-
static status?: number;
|
|
18
|
-
static message?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Name of the class that raised the exception.
|
|
21
|
-
*/
|
|
22
|
-
name: string;
|
|
23
|
-
/**
|
|
24
|
-
* Optional help description for the error. You can use it to define additional
|
|
25
|
-
* human readable information for the error.
|
|
26
|
-
*/
|
|
27
|
-
help?: string;
|
|
28
|
-
/**
|
|
29
|
-
* A machine readable error code. This will allow the error handling logic
|
|
30
|
-
* to narrow down exceptions based upon the error code.
|
|
31
|
-
*/
|
|
32
|
-
code?: string;
|
|
33
|
-
/**
|
|
34
|
-
* A status code for the error. Usually helpful when converting errors
|
|
35
|
-
* to HTTP responses.
|
|
36
|
-
*/
|
|
37
|
-
status: number;
|
|
38
|
-
constructor(message?: string, options?: ErrorOptions & {
|
|
39
|
-
code?: string;
|
|
40
|
-
status?: number;
|
|
41
|
-
});
|
|
42
|
-
get [Symbol.toStringTag](): string;
|
|
43
|
-
toString(): string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Helper to create anonymous error classes
|
|
47
|
-
*/
|
|
48
|
-
export declare function createError<T extends any[] = never>(message: string, code: string, status?: number): typeof Exception & T extends never ? {
|
|
49
|
-
new (args?: any, options?: ErrorOptions): Exception;
|
|
50
|
-
} : {
|
|
51
|
-
new (args: T, options?: ErrorOptions): Exception;
|
|
52
|
-
};
|
|
1
|
+
export { Exception, createError } from '@poppinss/exception';
|
package/build/src/exception.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './runtime_exception.js';
|
|
1
|
+
export { InvalidArgumentsException, RuntimeException } from '@poppinss/exception';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InvalidArgumentsException,
|
|
3
3
|
RuntimeException
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-4V5ON6P7.js";
|
|
5
|
+
import "../../chunk-2KG3PWR4.js";
|
|
6
6
|
export {
|
|
7
7
|
InvalidArgumentsException,
|
|
8
8
|
RuntimeException
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=main.js.map
|
package/build/src/json/main.js
CHANGED
|
@@ -1,58 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* A simple class to build an object incrementally. It is helpful when you
|
|
4
|
-
* want to add properties to the object conditionally.
|
|
5
|
-
*
|
|
6
|
-
* Instead of writing
|
|
7
|
-
* ```
|
|
8
|
-
* const obj = {
|
|
9
|
-
* ...(user.id ? { id: user.id } : {}),
|
|
10
|
-
* ...(user.firstName && user.lastName ? { name: `${user.firstName} ${user.lastName}` } : {}),
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* You can write
|
|
15
|
-
*
|
|
16
|
-
* const obj = new ObjectBuilder()
|
|
17
|
-
* .add('id', user.id)
|
|
18
|
-
* .add(
|
|
19
|
-
* 'fullName',
|
|
20
|
-
* user.firstName && user.lastName ? `${user.firstName} ${user.lastName}` : undefined
|
|
21
|
-
* )
|
|
22
|
-
* .toObject()
|
|
23
|
-
*/
|
|
24
|
-
export declare class ObjectBuilder<ReturnType extends Record<string, any>, IgnoreNull extends boolean = false> {
|
|
25
|
-
#private;
|
|
26
|
-
values: ReturnType;
|
|
27
|
-
constructor(initialValue: ReturnType, ignoreNull?: IgnoreNull);
|
|
28
|
-
/**
|
|
29
|
-
* Add a key-value pair to the object
|
|
30
|
-
*
|
|
31
|
-
* - Undefined values are ignored
|
|
32
|
-
* - Null values are ignored, when `ignoreNull` is set to true
|
|
33
|
-
*/
|
|
34
|
-
add<Prop extends string>(key: Prop, value: undefined): this;
|
|
35
|
-
add<Prop extends string, Value>(key: Prop, value: Value): ObjectBuilder<ReturnType & {
|
|
36
|
-
[P in Prop]: Value;
|
|
37
|
-
}, IgnoreNull>;
|
|
38
|
-
/**
|
|
39
|
-
* Remove key from the object
|
|
40
|
-
*/
|
|
41
|
-
remove<K extends keyof ReturnType>(key: K): this;
|
|
42
|
-
/**
|
|
43
|
-
* Find if a value exists
|
|
44
|
-
*/
|
|
45
|
-
has<K extends keyof ReturnType>(key: K): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Get the existing value for a given key
|
|
48
|
-
*/
|
|
49
|
-
get<K extends keyof ReturnType>(key: K): ReturnType[K];
|
|
50
|
-
/**
|
|
51
|
-
* Get the underlying constructed object
|
|
52
|
-
*/
|
|
53
|
-
toObject(): IgnoreNull extends true ? {
|
|
54
|
-
[K in keyof OmitProperties<ReturnType, null>]: ReturnType[K];
|
|
55
|
-
} : {
|
|
56
|
-
[K in keyof ReturnType]: ReturnType[K];
|
|
57
|
-
};
|
|
58
|
-
}
|
|
1
|
+
export * from '@poppinss/object-builder';
|
package/build/src/slash.d.ts
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copy-pasted from https://github.com/sindresorhus/slash/blob/main/index.d.ts
|
|
3
|
+
* @credit - https://github.com/sindresorhus/slash
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`.
|
|
7
|
+
* [Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as
|
|
8
|
+
* they're not extended-length paths.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* import path from 'node:path';
|
|
13
|
+
* import slash from 'slash';
|
|
14
|
+
*
|
|
15
|
+
* const string = path.join('foo', 'bar');
|
|
16
|
+
* // Unix => foo/bar
|
|
17
|
+
* // Windows => foo\\bar
|
|
18
|
+
*
|
|
19
|
+
* slash(string);
|
|
20
|
+
* // Unix => foo/bar
|
|
21
|
+
* // Windows => foo/bar
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function slash(path: string): string;
|
package/build/src/slash.js
CHANGED
|
@@ -1,49 +1 @@
|
|
|
1
|
-
|
|
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';
|
|
9
|
-
/**
|
|
10
|
-
* Condense multiple whitespaces from a string
|
|
11
|
-
*/
|
|
12
|
-
declare function condenseWhitespace(value: string): string;
|
|
13
|
-
declare const string: {
|
|
14
|
-
excerpt: typeof excerpt;
|
|
15
|
-
truncate: typeof truncate;
|
|
16
|
-
slug: typeof import("slugify").default;
|
|
17
|
-
interpolate: typeof interpolate;
|
|
18
|
-
plural: typeof import("pluralize").plural;
|
|
19
|
-
pluralize: typeof pluralize;
|
|
20
|
-
singular: typeof import("pluralize").singular;
|
|
21
|
-
isPlural: typeof import("pluralize").isPlural;
|
|
22
|
-
isSingular: typeof import("pluralize").isSingular;
|
|
23
|
-
camelCase: typeof camelCase;
|
|
24
|
-
capitalCase: typeof capitalCase;
|
|
25
|
-
dashCase: typeof dashCase;
|
|
26
|
-
dotCase: typeof dotCase;
|
|
27
|
-
noCase: typeof noCase;
|
|
28
|
-
pascalCase: typeof pascalCase;
|
|
29
|
-
sentenceCase: typeof sentenceCase;
|
|
30
|
-
snakeCase: typeof snakeCase;
|
|
31
|
-
titleCase: typeof titleCase;
|
|
32
|
-
random: typeof random;
|
|
33
|
-
sentence: typeof sentence;
|
|
34
|
-
condenseWhitespace: typeof condenseWhitespace;
|
|
35
|
-
seconds: {
|
|
36
|
-
format(seconds: number, long?: boolean): string;
|
|
37
|
-
parse(duration: string | number): number;
|
|
38
|
-
};
|
|
39
|
-
milliseconds: {
|
|
40
|
-
format(milliseconds: number, long?: boolean): string;
|
|
41
|
-
parse(duration: string | number): number;
|
|
42
|
-
};
|
|
43
|
-
bytes: {
|
|
44
|
-
format(valueInBytes: number, options?: import("bytes").BytesOptions): string;
|
|
45
|
-
parse(unit: string | number): number;
|
|
46
|
-
};
|
|
47
|
-
ordinal: typeof ordinal;
|
|
48
|
-
};
|
|
49
|
-
export default string;
|
|
1
|
+
export * from '@poppinss/string';
|
package/build/src/string/main.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@poppinss/string/builder';
|
package/build/src/types.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.js.map
|