@orieljs/support 0.1.0-alpha.5 → 0.1.0-alpha.6
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/NOTICE +3 -0
- package/dist/index.d.ts +88 -3
- package/dist/index.js +1741 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/NOTICE
CHANGED
|
@@ -7,3 +7,6 @@ This product includes software developed by the Oriel project
|
|
|
7
7
|
Oriel is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
8
8
|
The Oriel name and logo are not covered by that license; see TRADEMARKS.md
|
|
9
9
|
(https://github.com/orieljs/framework/blob/main/TRADEMARKS.md).
|
|
10
|
+
|
|
11
|
+
@orieljs/support (and @orieljs/framework, which bundles it) includes transliteration data from
|
|
12
|
+
voku/portable-ascii (https://github.com/voku/portable-ascii), Copyright (C) 2019 Lars Moelleken, MIT License.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,72 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Collection } from '@orieljs/collections';
|
|
2
2
|
export { collect } from '@orieljs/collections';
|
|
3
|
+
import { ServiceProvider as ServiceProvider$1, Application, Abstract, ClassRegistry as ClassRegistry$1, Class, ConfigRepository } from '@orieljs/contracts';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Laravel's Stringable: a string with Str's helpers as chainable methods, each returning a new Stringable.
|
|
7
|
+
* `Str.of(' Café ').trim().slug().toString()` is 'cafe'; `request().string('q')` returns one. It prints as its string.
|
|
8
|
+
*/
|
|
9
|
+
declare class Stringable {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(value?: string);
|
|
12
|
+
after(search: string): Stringable;
|
|
13
|
+
afterLast(search: string): Stringable;
|
|
14
|
+
append(...values: string[]): Stringable;
|
|
15
|
+
ascii(): Stringable;
|
|
16
|
+
before(search: string): Stringable;
|
|
17
|
+
beforeLast(search: string): Stringable;
|
|
18
|
+
between(from: string, to: string): Stringable;
|
|
19
|
+
camel(): Stringable;
|
|
20
|
+
contains(needles: string | string[]): boolean;
|
|
21
|
+
endsWith(needles: string | string[]): boolean;
|
|
22
|
+
/** The same string as `value` (a string or another Stringable). */
|
|
23
|
+
exactly(value: string | Stringable): boolean;
|
|
24
|
+
/** The parts between the delimiters, as a Collection (PHP's explode()). */
|
|
25
|
+
explode(delimiter: string): Collection<string>;
|
|
26
|
+
finish(cap: string): Stringable;
|
|
27
|
+
/** Wildcard match, as Str.is(): `*` matches anything. */
|
|
28
|
+
is(pattern: string): boolean;
|
|
29
|
+
isEmpty(): boolean;
|
|
30
|
+
isNotEmpty(): boolean;
|
|
31
|
+
kebab(): Stringable;
|
|
32
|
+
lcfirst(): Stringable;
|
|
33
|
+
/** The number of characters (code points, as PHP's mb_strlen()). */
|
|
34
|
+
length(): number;
|
|
35
|
+
limit(limit?: number, end?: string): Stringable;
|
|
36
|
+
lower(): Stringable;
|
|
37
|
+
/** Strips whitespace and invisible characters from the start, or the characters given. */
|
|
38
|
+
ltrim(characters?: string): Stringable;
|
|
39
|
+
plural(count?: number): Stringable;
|
|
40
|
+
prepend(...values: string[]): Stringable;
|
|
41
|
+
/** Replaces every occurrence of the search string (or of each of several) with `replace`. */
|
|
42
|
+
replace(search: string | string[], replace: string): Stringable;
|
|
43
|
+
/** Strips whitespace and invisible characters from the end, or the characters given. */
|
|
44
|
+
rtrim(characters?: string): Stringable;
|
|
45
|
+
singular(): Stringable;
|
|
46
|
+
slug(separator?: string): Stringable;
|
|
47
|
+
snake(delimiter?: string): Stringable;
|
|
48
|
+
start(prefix: string): Stringable;
|
|
49
|
+
startsWith(needles: string | string[]): boolean;
|
|
50
|
+
studly(): Stringable;
|
|
51
|
+
title(): Stringable;
|
|
52
|
+
/** PHP's filter_var(FILTER_VALIDATE_BOOLEAN): '1', 'true', 'on' and 'yes' (any case, trimmed) are true. */
|
|
53
|
+
toBoolean(): boolean;
|
|
54
|
+
/** PHP's floatval(): the leading number, else 0. */
|
|
55
|
+
toFloat(): number;
|
|
56
|
+
/** PHP's intval(): the leading digits, else 0. */
|
|
57
|
+
toInteger(): number;
|
|
58
|
+
toJSON(): string;
|
|
59
|
+
toString(): string;
|
|
60
|
+
/** Strips whitespace and invisible characters from both ends (Laravel's Str::trim()), or the characters given. */
|
|
61
|
+
trim(characters?: string): Stringable;
|
|
62
|
+
ucfirst(): Stringable;
|
|
63
|
+
upper(): Stringable;
|
|
64
|
+
value(): string;
|
|
65
|
+
}
|
|
3
66
|
|
|
4
67
|
declare const Str: {
|
|
68
|
+
/** Laravel's Str::of(): the value as a Stringable, for chaining: Str.of(title).trim().slug(). */
|
|
69
|
+
of: (value?: unknown) => Stringable;
|
|
5
70
|
ucfirst: (v: string) => string;
|
|
6
71
|
lcfirst: (v: string) => string;
|
|
7
72
|
studly: (v: string) => string;
|
|
@@ -9,11 +74,31 @@ declare const Str: {
|
|
|
9
74
|
snake: (v: string, delimiter?: string) => string;
|
|
10
75
|
kebab: (v: string) => string;
|
|
11
76
|
title: (v: string) => string;
|
|
12
|
-
|
|
77
|
+
/** Laravel's Str::ascii(): the value in plain ASCII ('Café' → 'Cafe', 'Ελληνικά' → 'Ellinika'), as for English. */
|
|
78
|
+
ascii: (v: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Laravel's Str::slug(): transliterated to ASCII first (unless `language` is null), '@' read as 'at', then lower-cased
|
|
81
|
+
* letters and digits joined by the separator: 'Café crème' → 'cafe-creme'. What has no ASCII form is dropped.
|
|
82
|
+
*/
|
|
83
|
+
slug: (title: string, separator?: string, language?: "en" | null, dictionary?: Readonly<Record<string, string>>) => string;
|
|
13
84
|
plural: (v: string, count?: number) => string;
|
|
14
85
|
singular: (v: string) => string;
|
|
15
86
|
random: (length?: number) => string;
|
|
16
87
|
uuid: () => `${string}-${string}-${string}-${string}-${string}`;
|
|
88
|
+
/**
|
|
89
|
+
* A version 7 UUID (RFC 9562): the time in milliseconds first, so ids from later milliseconds sort after earlier ones
|
|
90
|
+
* (within one millisecond the order is random). Throws a TypeError for a time before 1970, after 10889 or invalid.
|
|
91
|
+
*/
|
|
92
|
+
uuid7: (time?: Date) => string;
|
|
93
|
+
/**
|
|
94
|
+
* A ULID: 26 upper-case Crockford characters, ten for the time in milliseconds and sixteen random, so ids from later
|
|
95
|
+
* milliseconds sort after earlier ones. Throws a TypeError for a time before 1970, after 10889 or invalid.
|
|
96
|
+
*/
|
|
97
|
+
ulid: (time?: Date) => string;
|
|
98
|
+
/** Laravel's Str::isUuid(): five groups of hex digits, any version. */
|
|
99
|
+
isUuid: (value: unknown) => value is string;
|
|
100
|
+
/** Laravel's Str::isUlid(): 26 Crockford characters in either case, the first at most 7. */
|
|
101
|
+
isUlid: (value: unknown) => value is string;
|
|
17
102
|
/** Wildcard match: `*` matches anything; everything else is literal. */
|
|
18
103
|
is: (pattern: string, value: string) => boolean;
|
|
19
104
|
startsWith: (v: string, needles: string | string[]) => boolean;
|
|
@@ -149,4 +234,4 @@ declare namespace fileType {
|
|
|
149
234
|
export { fileType_AVIF as AVIF, fileType_BINARY_AND_MARKUP_TYPES as BINARY_AND_MARKUP_TYPES, fileType_BMP as BMP, type fileType_DetectedType as DetectedType, fileType_EMPTY as EMPTY, fileType_GIF as GIF, fileType_HTML as HTML, fileType_JPEG as JPEG, fileType_PDF as PDF, fileType_PNG as PNG, fileType_RASTER_IMAGES as RASTER_IMAGES, fileType_SNIFF_BYTES as SNIFF_BYTES, fileType_SVG as SVG, fileType_TEXT as TEXT, fileType_UNKNOWN as UNKNOWN, fileType_WEBP as WEBP, fileType_XML as XML, fileType_detectFileType as detectFileType };
|
|
150
235
|
}
|
|
151
236
|
|
|
152
|
-
export { Arr, ClassRegistry, type Facade, type FacadeStatics, fileType as FileType, ServiceProvider, Str, __, app, config, facade, now, retry, tap, value };
|
|
237
|
+
export { Arr, ClassRegistry, type Facade, type FacadeStatics, fileType as FileType, ServiceProvider, Str, Stringable, __, app, config, facade, now, retry, tap, value };
|