@h3ravel/support 0.14.2 → 0.14.3
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/dist/{chunk-PECeCxCb.js → chunk-Bop6jNiL.js} +1 -1
- package/dist/index.d.cts +17 -17
- package/dist/index.d.ts +18 -17
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -23,9 +23,9 @@ type ExcerptOptions = {
|
|
|
23
23
|
radius?: number;
|
|
24
24
|
omission?: string;
|
|
25
25
|
};
|
|
26
|
-
type Value<T> = boolean | ((instance: T) => boolean);
|
|
27
|
-
type Callback<T> = (instance: T, value: boolean) => T | void | undefined;
|
|
28
|
-
type Fallback<T> = Callback<T> | null;
|
|
26
|
+
type Value<T$1> = boolean | ((instance: T$1) => boolean);
|
|
27
|
+
type Callback<T$1> = (instance: T$1, value: boolean) => T$1 | void | undefined;
|
|
28
|
+
type Fallback<T$1> = Callback<T$1> | null;
|
|
29
29
|
interface Function {
|
|
30
30
|
(...args: any[]): any;
|
|
31
31
|
}
|
|
@@ -34,12 +34,12 @@ interface Function {
|
|
|
34
34
|
/**
|
|
35
35
|
* Convert CamelCased Object keys to snake_case
|
|
36
36
|
*/
|
|
37
|
-
type KeysToSnakeCase<T> = { [K in keyof T as CamelToSnakeCase<string & K>]: T[K] };
|
|
38
|
-
type TGeneric<V = any, K extends string = string> = Record<K, V>;
|
|
39
|
-
type XGeneric<V = TGeneric, T = any> = {
|
|
40
|
-
[key: string]: T;
|
|
41
|
-
} & V;
|
|
42
|
-
type DotPath<T> = T extends object ? { [K in keyof T & (string | number)]: T[K] extends object ? `${K}` | `${K}.${DotPath<T[K]>}` : `${K}` }[keyof T & (string | number)] : never;
|
|
37
|
+
type KeysToSnakeCase<T$1> = { [K in keyof T$1 as CamelToSnakeCase<string & K>]: T$1[K] };
|
|
38
|
+
type TGeneric<V$1 = any, K$1 extends string = string> = Record<K$1, V$1>;
|
|
39
|
+
type XGeneric<V$1 = TGeneric, T$1 = any> = {
|
|
40
|
+
[key: string]: T$1;
|
|
41
|
+
} & V$1;
|
|
42
|
+
type DotPath<T$1> = T$1 extends object ? { [K in keyof T$1 & (string | number)]: T$1[K] extends object ? `${K}` | `${K}.${DotPath<T$1[K]>}` : `${K}` }[keyof T$1 & (string | number)] : never;
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/Contracts/TypeCast.d.ts
|
|
45
45
|
type Arrayable = {
|
|
@@ -294,8 +294,8 @@ declare const getValue: <T extends Record<string, any>>(key: string | [keyof T,
|
|
|
294
294
|
* @returns A new object with transformed entries
|
|
295
295
|
*/
|
|
296
296
|
declare const modObj: <T extends object, R>(obj: T, callback: (_entry: [keyof T & string, T[keyof T]]) => [string, R]) => Record<string, R>;
|
|
297
|
-
declare function safeDot<T extends Record<string, any>>(_data: T): T;
|
|
298
|
-
declare function safeDot<T extends Record<string, any>, K extends DotNestedKeys<T>>(_data: T, _key?: K): DotNestedValue<T, K>;
|
|
297
|
+
declare function safeDot<T$1 extends Record<string, any>>(_data: T$1): T$1;
|
|
298
|
+
declare function safeDot<T$1 extends Record<string, any>, K$1 extends DotNestedKeys<T$1>>(_data: T$1, _key?: K$1): DotNestedValue<T$1, K$1>;
|
|
299
299
|
/**
|
|
300
300
|
* Sets a nested property on an object using dot notation.
|
|
301
301
|
*
|
|
@@ -328,14 +328,14 @@ declare const slugifyKeys: <T extends object>(obj: T, only?: string[], separator
|
|
|
328
328
|
* - Objects: keys included if value is truthy
|
|
329
329
|
* - Strings: included as-is
|
|
330
330
|
*/
|
|
331
|
-
declare function toCssClasses<T extends string | Record<string, boolean> | Array<string | false | null | undefined>>(input: T): string;
|
|
331
|
+
declare function toCssClasses<T$1 extends string | Record<string, boolean> | Array<string | false | null | undefined>>(input: T$1): string;
|
|
332
332
|
/**
|
|
333
333
|
* toCssStyles
|
|
334
334
|
*
|
|
335
335
|
* Convert object input into CSS style string.
|
|
336
336
|
* - Only includes truthy values (ignores null/undefined/false)
|
|
337
337
|
*/
|
|
338
|
-
declare function toCssStyles<T extends Record<string, string | number | boolean | null | undefined>>(styles: T): string;
|
|
338
|
+
declare function toCssStyles<T$1 extends Record<string, string | number | boolean | null | undefined>>(styles: T$1): string;
|
|
339
339
|
/**
|
|
340
340
|
* undot
|
|
341
341
|
*
|
|
@@ -350,13 +350,13 @@ declare function undot(obj: Record<string, any>): Record<string, any>;
|
|
|
350
350
|
*
|
|
351
351
|
* Get a value from an object using dot notation.
|
|
352
352
|
*/
|
|
353
|
-
declare function data_get<T extends object, P extends DotPath<T> | DotPath<T>[], D = undefined>(obj: T, path: P, defaultValue?: D): T | any;
|
|
353
|
+
declare function data_get<T$1 extends object, P$1 extends DotPath<T$1> | DotPath<T$1>[], D$1 = undefined>(obj: T$1, path: P$1, defaultValue?: D$1): T$1 | any;
|
|
354
354
|
/**
|
|
355
355
|
* data_set
|
|
356
356
|
*
|
|
357
357
|
* Set a value in an object using dot notation. Mutates the object.
|
|
358
358
|
*/
|
|
359
|
-
declare function data_set<T extends Record<string, any>, P extends string | string[], V>(obj: T, path: P, value: V): asserts obj is T & Record<P extends string ? P : P[0], V>;
|
|
359
|
+
declare function data_set<T$1 extends Record<string, any>, P$1 extends string | string[], V$1>(obj: T$1, path: P$1, value: V$1): asserts obj is T$1 & Record<P$1 extends string ? P$1 : P$1[0], V$1>;
|
|
360
360
|
/**
|
|
361
361
|
* data_fill
|
|
362
362
|
*
|
|
@@ -467,7 +467,7 @@ declare class Arr {
|
|
|
467
467
|
* Arr.divide(['a','b']) -> [[0,1], ['a','b']]
|
|
468
468
|
* Arr.divide({x:1,y:2}) -> [['x','y'], [1,2]]
|
|
469
469
|
*/
|
|
470
|
-
static divide<A>(input: A[] | Record<string, A>): (A[] | number[])[] | (
|
|
470
|
+
static divide<A>(input: A[] | Record<string, A>): (A[] | number[])[] | (string[] | A[])[];
|
|
471
471
|
/**
|
|
472
472
|
* Flatten a nested array/object structure into a single-level object
|
|
473
473
|
* with dot-notated keys.
|
|
@@ -3147,7 +3147,7 @@ declare class HtmlString {
|
|
|
3147
3147
|
declare function str(string?: string): Stringable;
|
|
3148
3148
|
//#endregion
|
|
3149
3149
|
//#region src/GlobalBootstrap.d.ts
|
|
3150
|
-
type CollapseStatics<T extends Record<string, any>> = { [K in keyof T]: T[K] };
|
|
3150
|
+
type CollapseStatics<T$1 extends Record<string, any>> = { [K in keyof T$1]: T$1[K] };
|
|
3151
3151
|
type Omitables = 'start' | 'take' | 'reverse' | 'chunk' | 'find' | 'pop' | 'end' | 'shift' | 'push' | 'at' | 'prototype' | 'concat' | 'join' | 'slice' | 'sort' | 'splice' | 'includes' | 'indexOf' | 'lastIndexOf' | 'findIndex' | 'every' | 'some' | 'forEach' | 'map' | 'filter' | 'reduce' | 'unshift' | 'flat' | 'flatMap' | 'keys' | 'fill' | 'copyWithin' | 'entries' | 'values' | 'reduceRight' | 'length' | 'of' | '_isObject' | '_clone' | 'crossJoin' | 'divide' | 'wrap' | 'except' | 'hasAny' | 'isList' | 'keyBy' | 'mapWithKeys' | 'only' | 'pluck' | 'pull' | 'shuffle' | 'sortDesc' | 'sortRecursive' | 'sortRecursiveDesc' | 'where' | 'whereNotNull' | 'head' | 'string' | 'boolean' | 'array' | 'float' | 'from' | 'hasAll' | 'integer' | 'mapSpread' | 'partition' | 'reject' | 'select' | 'sole' | 'alternate' | 'combine' | 'isEmpty' | 'isNotEmpty' | 'range' | typeof Symbol.unscopables | typeof Symbol.iterator;
|
|
3152
3152
|
type TakeTime = Pick<typeof DateTime, 'now' | 'format' | 'fromTimestamp' | 'randomTime' | 'firstDayOfMonth' | 'lastDayOfMonth' | 'parse'>;
|
|
3153
3153
|
type TakeString = Pick<typeof Str, 'after' | 'afterLast' | 'apa' | 'ascii' | 'before' | 'beforeLast' | 'between' | 'betweenFirst' | 'capitalize' | 'plural' | 'singular' | 'title'>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference path="./app.globals.d.ts" />
|
|
2
|
+
import { t as __export } from "./chunk-Bop6jNiL.js";
|
|
2
3
|
import dayjs, { ConfigType, Dayjs, OpUnitType } from "dayjs";
|
|
3
4
|
import { DotFlatten, DotNestedKeys, DotNestedValue } from "@h3ravel/shared";
|
|
4
5
|
|
|
@@ -20,9 +21,9 @@ type ExcerptOptions = {
|
|
|
20
21
|
radius?: number;
|
|
21
22
|
omission?: string;
|
|
22
23
|
};
|
|
23
|
-
type Value<T> = boolean | ((instance: T) => boolean);
|
|
24
|
-
type Callback<T> = (instance: T, value: boolean) => T | void | undefined;
|
|
25
|
-
type Fallback<T> = Callback<T> | null;
|
|
24
|
+
type Value<T$1> = boolean | ((instance: T$1) => boolean);
|
|
25
|
+
type Callback<T$1> = (instance: T$1, value: boolean) => T$1 | void | undefined;
|
|
26
|
+
type Fallback<T$1> = Callback<T$1> | null;
|
|
26
27
|
interface Function {
|
|
27
28
|
(...args: any[]): any;
|
|
28
29
|
}
|
|
@@ -31,12 +32,12 @@ interface Function {
|
|
|
31
32
|
/**
|
|
32
33
|
* Convert CamelCased Object keys to snake_case
|
|
33
34
|
*/
|
|
34
|
-
type KeysToSnakeCase<T> = { [K in keyof T as CamelToSnakeCase<string & K>]: T[K] };
|
|
35
|
-
type TGeneric<V = any, K extends string = string> = Record<K, V>;
|
|
36
|
-
type XGeneric<V = TGeneric, T = any> = {
|
|
37
|
-
[key: string]: T;
|
|
38
|
-
} & V;
|
|
39
|
-
type DotPath<T> = T extends object ? { [K in keyof T & (string | number)]: T[K] extends object ? `${K}` | `${K}.${DotPath<T[K]>}` : `${K}` }[keyof T & (string | number)] : never;
|
|
35
|
+
type KeysToSnakeCase<T$1> = { [K in keyof T$1 as CamelToSnakeCase<string & K>]: T$1[K] };
|
|
36
|
+
type TGeneric<V$1 = any, K$1 extends string = string> = Record<K$1, V$1>;
|
|
37
|
+
type XGeneric<V$1 = TGeneric, T$1 = any> = {
|
|
38
|
+
[key: string]: T$1;
|
|
39
|
+
} & V$1;
|
|
40
|
+
type DotPath<T$1> = T$1 extends object ? { [K in keyof T$1 & (string | number)]: T$1[K] extends object ? `${K}` | `${K}.${DotPath<T$1[K]>}` : `${K}` }[keyof T$1 & (string | number)] : never;
|
|
40
41
|
//#endregion
|
|
41
42
|
//#region src/Contracts/TypeCast.d.ts
|
|
42
43
|
type Arrayable = {
|
|
@@ -291,8 +292,8 @@ declare const getValue: <T extends Record<string, any>>(key: string | [keyof T,
|
|
|
291
292
|
* @returns A new object with transformed entries
|
|
292
293
|
*/
|
|
293
294
|
declare const modObj: <T extends object, R>(obj: T, callback: (_entry: [keyof T & string, T[keyof T]]) => [string, R]) => Record<string, R>;
|
|
294
|
-
declare function safeDot<T extends Record<string, any>>(_data: T): T;
|
|
295
|
-
declare function safeDot<T extends Record<string, any>, K extends DotNestedKeys<T>>(_data: T, _key?: K): DotNestedValue<T, K>;
|
|
295
|
+
declare function safeDot<T$1 extends Record<string, any>>(_data: T$1): T$1;
|
|
296
|
+
declare function safeDot<T$1 extends Record<string, any>, K$1 extends DotNestedKeys<T$1>>(_data: T$1, _key?: K$1): DotNestedValue<T$1, K$1>;
|
|
296
297
|
/**
|
|
297
298
|
* Sets a nested property on an object using dot notation.
|
|
298
299
|
*
|
|
@@ -325,14 +326,14 @@ declare const slugifyKeys: <T extends object>(obj: T, only?: string[], separator
|
|
|
325
326
|
* - Objects: keys included if value is truthy
|
|
326
327
|
* - Strings: included as-is
|
|
327
328
|
*/
|
|
328
|
-
declare function toCssClasses<T extends string | Record<string, boolean> | Array<string | false | null | undefined>>(input: T): string;
|
|
329
|
+
declare function toCssClasses<T$1 extends string | Record<string, boolean> | Array<string | false | null | undefined>>(input: T$1): string;
|
|
329
330
|
/**
|
|
330
331
|
* toCssStyles
|
|
331
332
|
*
|
|
332
333
|
* Convert object input into CSS style string.
|
|
333
334
|
* - Only includes truthy values (ignores null/undefined/false)
|
|
334
335
|
*/
|
|
335
|
-
declare function toCssStyles<T extends Record<string, string | number | boolean | null | undefined>>(styles: T): string;
|
|
336
|
+
declare function toCssStyles<T$1 extends Record<string, string | number | boolean | null | undefined>>(styles: T$1): string;
|
|
336
337
|
/**
|
|
337
338
|
* undot
|
|
338
339
|
*
|
|
@@ -347,13 +348,13 @@ declare function undot(obj: Record<string, any>): Record<string, any>;
|
|
|
347
348
|
*
|
|
348
349
|
* Get a value from an object using dot notation.
|
|
349
350
|
*/
|
|
350
|
-
declare function data_get<T extends object, P extends DotPath<T> | DotPath<T>[], D = undefined>(obj: T, path: P, defaultValue?: D): T | any;
|
|
351
|
+
declare function data_get<T$1 extends object, P$1 extends DotPath<T$1> | DotPath<T$1>[], D$1 = undefined>(obj: T$1, path: P$1, defaultValue?: D$1): T$1 | any;
|
|
351
352
|
/**
|
|
352
353
|
* data_set
|
|
353
354
|
*
|
|
354
355
|
* Set a value in an object using dot notation. Mutates the object.
|
|
355
356
|
*/
|
|
356
|
-
declare function data_set<T extends Record<string, any>, P extends string | string[], V>(obj: T, path: P, value: V): asserts obj is T & Record<P extends string ? P : P[0], V>;
|
|
357
|
+
declare function data_set<T$1 extends Record<string, any>, P$1 extends string | string[], V$1>(obj: T$1, path: P$1, value: V$1): asserts obj is T$1 & Record<P$1 extends string ? P$1 : P$1[0], V$1>;
|
|
357
358
|
/**
|
|
358
359
|
* data_fill
|
|
359
360
|
*
|
|
@@ -464,7 +465,7 @@ declare class Arr {
|
|
|
464
465
|
* Arr.divide(['a','b']) -> [[0,1], ['a','b']]
|
|
465
466
|
* Arr.divide({x:1,y:2}) -> [['x','y'], [1,2]]
|
|
466
467
|
*/
|
|
467
|
-
static divide<A>(input: A[] | Record<string, A>): (A[] | number[])[] | (
|
|
468
|
+
static divide<A>(input: A[] | Record<string, A>): (A[] | number[])[] | (string[] | A[])[];
|
|
468
469
|
/**
|
|
469
470
|
* Flatten a nested array/object structure into a single-level object
|
|
470
471
|
* with dot-notated keys.
|
|
@@ -3144,7 +3145,7 @@ declare class HtmlString {
|
|
|
3144
3145
|
declare function str(string?: string): Stringable;
|
|
3145
3146
|
//#endregion
|
|
3146
3147
|
//#region src/GlobalBootstrap.d.ts
|
|
3147
|
-
type CollapseStatics<T extends Record<string, any>> = { [K in keyof T]: T[K] };
|
|
3148
|
+
type CollapseStatics<T$1 extends Record<string, any>> = { [K in keyof T$1]: T$1[K] };
|
|
3148
3149
|
type Omitables = 'start' | 'take' | 'reverse' | 'chunk' | 'find' | 'pop' | 'end' | 'shift' | 'push' | 'at' | 'prototype' | 'concat' | 'join' | 'slice' | 'sort' | 'splice' | 'includes' | 'indexOf' | 'lastIndexOf' | 'findIndex' | 'every' | 'some' | 'forEach' | 'map' | 'filter' | 'reduce' | 'unshift' | 'flat' | 'flatMap' | 'keys' | 'fill' | 'copyWithin' | 'entries' | 'values' | 'reduceRight' | 'length' | 'of' | '_isObject' | '_clone' | 'crossJoin' | 'divide' | 'wrap' | 'except' | 'hasAny' | 'isList' | 'keyBy' | 'mapWithKeys' | 'only' | 'pluck' | 'pull' | 'shuffle' | 'sortDesc' | 'sortRecursive' | 'sortRecursiveDesc' | 'where' | 'whereNotNull' | 'head' | 'string' | 'boolean' | 'array' | 'float' | 'from' | 'hasAll' | 'integer' | 'mapSpread' | 'partition' | 'reject' | 'select' | 'sole' | 'alternate' | 'combine' | 'isEmpty' | 'isNotEmpty' | 'range' | typeof Symbol.unscopables | typeof Symbol.iterator;
|
|
3149
3150
|
type TakeTime = Pick<typeof DateTime, 'now' | 'format' | 'fromTimestamp' | 'randomTime' | 'firstDayOfMonth' | 'lastDayOfMonth' | 'parse'>;
|
|
3150
3151
|
type TakeString = Pick<typeof Str, 'after' | 'afterLast' | 'apa' | 'ascii' | 'before' | 'beforeLast' | 'between' | 'betweenFirst' | 'capitalize' | 'plural' | 'singular' | 'title'>;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/support",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "Shared helpers, facades and utilities for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/luxon": "^3.7.1",
|
|
40
40
|
"typescript": "^5.4.0",
|
|
41
|
-
"@h3ravel/shared": "^0.
|
|
41
|
+
"@h3ravel/shared": "^0.24.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"dayjs": "^1.11.18",
|