@oscarpalmer/atoms 0.219.0 → 0.221.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/dist/index.d.mts +57 -19
- package/dist/index.mjs +285 -203
- package/dist/internal/function/assert.mjs +1 -3
- package/dist/internal/string/case.d.mts +2 -0
- package/dist/internal/string/case.mjs +36 -29
- package/dist/internal/subscription.mjs +2 -6
- package/dist/models/string/string.case.model.d.mts +8 -3
- package/dist/models/string/string.case.model.mjs +9 -4
- package/dist/models/string/string.fuzzy.model.d.mts +46 -18
- package/dist/models/string/string.fuzzy.model.mjs +3 -1
- package/dist/models/string/string.misc.model.mjs +1 -1
- package/dist/models/string/string.template.model.mjs +1 -1
- package/dist/string/fuzzy.d.mts +3 -3
- package/dist/string/fuzzy.mjs +171 -97
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4417,6 +4417,14 @@ export declare namespace pipe {
|
|
|
4417
4417
|
export var async: typeof asyncPipe;
|
|
4418
4418
|
}
|
|
4419
4419
|
//#endregion
|
|
4420
|
+
//#region src/models/string/string.case.model.d.ts
|
|
4421
|
+
type StringCase = "camel" | "capitalize" | "kebab" | "lower" | "pascal" | "snake" | "title" | "upper";
|
|
4422
|
+
type StringCaseOptions = {
|
|
4423
|
+
capitalizeAny: boolean;
|
|
4424
|
+
capitalizeFirst: boolean;
|
|
4425
|
+
type: StringCase;
|
|
4426
|
+
};
|
|
4427
|
+
//#endregion
|
|
4420
4428
|
//#region src/internal/string/case.d.ts
|
|
4421
4429
|
/**
|
|
4422
4430
|
* Convert a string to camel case _(thisIsCamelCase)_
|
|
@@ -4522,6 +4530,7 @@ export declare function snakeCase(value: string): string;
|
|
|
4522
4530
|
* ```
|
|
4523
4531
|
*/
|
|
4524
4532
|
export declare function titleCase(value: string): string;
|
|
4533
|
+
export declare function toCaseCallback(this: StringCaseOptions, value: string): string;
|
|
4525
4534
|
/**
|
|
4526
4535
|
* Convert a string to upper case
|
|
4527
4536
|
*
|
|
@@ -6367,26 +6376,28 @@ type Fuzzy<Item> = {
|
|
|
6367
6376
|
*
|
|
6368
6377
|
* @param value Value to search for
|
|
6369
6378
|
* @param options Search options
|
|
6370
|
-
* @returns Search results, with exact
|
|
6379
|
+
* @returns Search results, with exact, included, and similar matches
|
|
6371
6380
|
*/
|
|
6372
6381
|
search(value: string, options?: FuzzyOptions): FuzzyResult<Item>;
|
|
6373
6382
|
/**
|
|
6374
6383
|
* Search for items matching the given value
|
|
6375
6384
|
*
|
|
6376
6385
|
* @param value Value to search for
|
|
6377
|
-
* @param limit Maximum number of combined items to return in `exact` and `similar`
|
|
6378
|
-
* @returns Search results, with exact
|
|
6386
|
+
* @param limit Maximum number of combined items to return in `exact`, `included`, and `similar`
|
|
6387
|
+
* @returns Search results, with exact, included, and similar matches
|
|
6379
6388
|
*/
|
|
6380
6389
|
search(value: string, limit: number): FuzzyResult<Item>;
|
|
6381
6390
|
};
|
|
6382
6391
|
type FuzzyConfiguration<Item> = {
|
|
6392
|
+
handler?: (item: Item) => string;
|
|
6383
6393
|
/**
|
|
6384
|
-
*
|
|
6394
|
+
* Function to compare the stringified items for results _(defaults to `Intl.Collator().compare`)_
|
|
6385
6395
|
*
|
|
6386
|
-
*
|
|
6387
|
-
*
|
|
6396
|
+
* @param first First string to compare
|
|
6397
|
+
* @param second Second string to compare
|
|
6398
|
+
* @returns Comparison result, similar to `Array.prototype.sort` callback
|
|
6388
6399
|
*/
|
|
6389
|
-
|
|
6400
|
+
compare?: (first: string, second: string) => number;
|
|
6390
6401
|
} & (Item extends PlainObject ? {
|
|
6391
6402
|
/**
|
|
6392
6403
|
* Key to use to stringify items
|
|
@@ -6395,13 +6406,13 @@ type FuzzyConfiguration<Item> = {
|
|
|
6395
6406
|
*/
|
|
6396
6407
|
key?: keyof Item;
|
|
6397
6408
|
} : {}) & FuzzyOptions;
|
|
6398
|
-
type FuzzyItem<
|
|
6399
|
-
|
|
6400
|
-
|
|
6409
|
+
type FuzzyItem<Data> = {
|
|
6410
|
+
data: Data;
|
|
6411
|
+
string: FuzzyString;
|
|
6401
6412
|
};
|
|
6402
6413
|
type FuzzyOptions = {
|
|
6403
6414
|
/**
|
|
6404
|
-
* Maximum number of combined items to return in `exact` and `similar` _(defaults to all matches)_
|
|
6415
|
+
* Maximum number of combined items to return in `exact`, `included`, and `similar` _(defaults to all matches)_
|
|
6405
6416
|
*/
|
|
6406
6417
|
limit?: number;
|
|
6407
6418
|
/**
|
|
@@ -6412,29 +6423,56 @@ type FuzzyOptions = {
|
|
|
6412
6423
|
*/
|
|
6413
6424
|
tolerance?: number;
|
|
6414
6425
|
};
|
|
6426
|
+
type FuzzyRanked<Data> = {
|
|
6427
|
+
position: number;
|
|
6428
|
+
/**
|
|
6429
|
+
* `0` for starting with the value, `1` for the value starting a word, `2` for anything else
|
|
6430
|
+
*/
|
|
6431
|
+
rank: number;
|
|
6432
|
+
} & FuzzyItem<Data>;
|
|
6415
6433
|
/**
|
|
6416
|
-
* Search results from a fuzzy search, with exact and similar matches
|
|
6434
|
+
* Search results from a fuzzy search, with exact, included, and similar matches
|
|
6417
6435
|
*/
|
|
6418
6436
|
type FuzzyResult<Item> = {
|
|
6419
6437
|
/**
|
|
6420
|
-
*
|
|
6438
|
+
* Items whose strings exactly match the search value, ordered alphabetically
|
|
6421
6439
|
*/
|
|
6422
6440
|
exact: Item[];
|
|
6423
6441
|
/**
|
|
6424
|
-
*
|
|
6442
|
+
* Items whose strings contain the search value, ordered alphabetically
|
|
6443
|
+
*/
|
|
6444
|
+
included: Item[];
|
|
6445
|
+
/**
|
|
6446
|
+
* Items whose strings are similar to the search value, ranked by relevance, sorted by score, and ordered alphabetically within the same score
|
|
6425
6447
|
*/
|
|
6426
6448
|
similar: Item[];
|
|
6427
6449
|
};
|
|
6428
6450
|
type FuzzyState<Item> = {
|
|
6451
|
+
compare: FuzzyStateCompare<Item>;
|
|
6429
6452
|
handler(item: Item): string;
|
|
6430
|
-
items: Item
|
|
6431
|
-
limit
|
|
6432
|
-
strings: string[];
|
|
6453
|
+
items: FuzzyStateItems<Item>;
|
|
6454
|
+
limit: number;
|
|
6433
6455
|
tolerance: number;
|
|
6434
6456
|
};
|
|
6457
|
+
type FuzzyStateCompare<Item = unknown> = {
|
|
6458
|
+
item: (first: FuzzyItem<Item>, second: FuzzyItem<Item>) => number;
|
|
6459
|
+
ranked: (first: FuzzyRanked<Item>, second: FuzzyRanked<Item>) => number;
|
|
6460
|
+
};
|
|
6461
|
+
type FuzzyStateItems<Item> = {
|
|
6462
|
+
original: Array<FuzzyItem<Item>>;
|
|
6463
|
+
sorted?: Array<FuzzyItem<Item>>;
|
|
6464
|
+
};
|
|
6465
|
+
type FuzzyString = {
|
|
6466
|
+
lowercase: string;
|
|
6467
|
+
original: string;
|
|
6468
|
+
};
|
|
6469
|
+
type InternalFuzzy<Item = unknown> = {
|
|
6470
|
+
[FUZZY_SYMBOL]: FuzzyState<Item>;
|
|
6471
|
+
} & Fuzzy<Item>;
|
|
6472
|
+
declare const FUZZY_SYMBOL: unique symbol;
|
|
6435
6473
|
//#endregion
|
|
6436
6474
|
//#region src/string/fuzzy.d.ts
|
|
6437
|
-
declare function Fuzzy(this:
|
|
6475
|
+
declare function Fuzzy(this: InternalFuzzy, state: FuzzyState<unknown>): void;
|
|
6438
6476
|
/**
|
|
6439
6477
|
* Create a fuzzy searcher for an array of items
|
|
6440
6478
|
*
|
|
@@ -9453,4 +9491,4 @@ export declare class SizedSet<Value = unknown> extends Set<Value> {
|
|
|
9453
9491
|
get(value: Value, update?: boolean): Value | undefined;
|
|
9454
9492
|
}
|
|
9455
9493
|
//#endregion
|
|
9456
|
-
export { type ArrayComparisonSorter, type ArrayKeySorter, type ArrayKeySorters, type ArraySorter, type ArraySorters, type ArrayValueSorter, type Asserter, type AssignOptions, type Assigner, type AsyncFailure, type AsyncFlow, type AsyncLimiter, type AsyncOnce, type AsyncPlan, type AsyncPlanned, type AsyncStep, type AsyncSuccess, type Beacon, type BeaconOptions, type CloneOptions, type Cloner, type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type CompareCallback, type ComparisonSorter, type DiffOptions, type DiffResult, type EqualOptions, type Equalizer, type Failure, type Flow, type FulfilledPromise, type Fuzzy, type
|
|
9494
|
+
export { type ArrayComparisonSorter, type ArrayKeySorter, type ArrayKeySorters, type ArraySorter, type ArraySorters, type ArrayValueSorter, type Asserter, type AssignOptions, type Assigner, type AsyncFailure, type AsyncFlow, type AsyncLimiter, type AsyncOnce, type AsyncPlan, type AsyncPlanned, type AsyncStep, type AsyncSuccess, type Beacon, type BeaconOptions, type CloneOptions, type Cloner, type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type CompareCallback, type ComparisonSorter, type DiffOptions, type DiffResult, type EqualOptions, type Equalizer, type Failure, type Flow, type FulfilledPromise, type Fuzzy, type FuzzyOptions, type FuzzyResult, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, type Herald, type HeraldEvents, type HeraldOptions, Key$1 as Key, type KeyedQueue, type Limiter, Logger, type Memoized, type MemoizedOptions, type MergeOptions, type Merger, type NormalizeOptions, type Normalizer, type Observable, type Observer, type Once, type Plan, type PlanError, type PlanOk, type PlanReturned, type Planned, type PromiseOptions, type PromiseStrategy, type PromisesOptions, type Queue, type QueueOptions, type Queued, type RGBAColor, type RGBColor, type RejectedPromise, type Renderer, type Shaken, type Smushed, type SortDirection, type Sorter, type Step, type Subscription, type SubscriptionParameters, type SubscriptionProperty, type Subscriptions, type SubscriptionsParameters, type Success, type TemplateOptions, type Templater, type TemplaterOptions, type TemplaterRenderer, type TimeLogger, type TransformCallback, type TransformCallbacks, type Transformer, type Unsmushed, push as append, filterAndMap as select, toPromise as fromResult, getRandomFloatingNumber as getRandomFloat, isLogger, isTimeLogger, mapAndFilter as reverseSelect };
|