-
typeof(value: unknown): string
works like native typeof
operator
-
isNullish(value: unknown): boolean
returns true
if value
is null
or undefined
-
isArray(value: unknown): boolean
returns true
if value
is array
-
useNotNullish<T>(values: readonly T[]): T | null
return first not-nullish element from values
-array or null
([null, 123].useNotNullish() = 123
)
-
serializeStringOrRegexp(value?: string | RegExp): SerializedStringOrRegexp | null
transform string or regexp into json-compatible format
-
deserializeStringOrRegexp(value?: SerializedStringOrRegexp | null): string | RegExp | null
reverse the result of serializeStringOrRegexp
-
semverSatisfies(version: string | SemVer, range: string | Range): boolean
returns true
if version
satisfied of range
-
isMatch(a?: string, b?: string | RegExp): boolean
returns true
if a
matches b
-
exclude<T>(
items: readonly T[],
params?: {
exclude?: Array<string | RegExp>;
get?: (arg: T) => string | undefined;
}
): T[]
Helps to exclude elements. Examples:
['foo', 'bar', 'foo'].exclude({exclude: 'foo'}) = ['bar']
[fooCompilation, barCompilation, bazCompilation].exclude({exclude: /foo|bar/, get: <name>}) = [bazCompilation]
-
diff_normalizeLimit(limit?: number | Limit | null): Limit | null
Normalize the limit
-
diff_isLTETheLimit(valueDiff: ValueDiff, limit?: number | Limit | null): boolean
Returns true
if valueDiff
has not been exceeded the limit