@zajno/common 2.7.6 → 2.7.7

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.
Files changed (80) hide show
  1. package/cjs/functions/disposer.js +7 -0
  2. package/cjs/functions/disposer.js.map +1 -1
  3. package/cjs/logger/buffered/buffered.memory.js +13 -1
  4. package/cjs/logger/buffered/buffered.memory.js.map +1 -1
  5. package/cjs/logger/loggable.js +1 -1
  6. package/cjs/logger/loggable.js.map +1 -1
  7. package/cjs/math/object/helpers.js +1 -1
  8. package/cjs/math/object/helpers.js.map +1 -1
  9. package/cjs/math/object/math.composite.js.map +1 -1
  10. package/cjs/math/object/math.js +1 -1
  11. package/cjs/math/object/math.js.map +1 -1
  12. package/cjs/math/object/ops.composite.js +1 -1
  13. package/cjs/math/object/ops.composite.js.map +1 -1
  14. package/cjs/math/object/ops.js +4 -3
  15. package/cjs/math/object/ops.js.map +1 -1
  16. package/cjs/structures/path/builder.helpers.js +5 -5
  17. package/cjs/structures/path/builder.helpers.js.map +1 -1
  18. package/cjs/structures/path/builder.js +3 -3
  19. package/cjs/structures/path/builder.js.map +1 -1
  20. package/cjs/structures/path/index.js +1 -1
  21. package/cjs/structures/path/index.js.map +1 -1
  22. package/cjs/structures/path/{utils.js → utils/combineUrls.js} +3 -16
  23. package/cjs/structures/path/utils/combineUrls.js.map +1 -0
  24. package/cjs/structures/path/utils/index.js +7 -0
  25. package/cjs/structures/path/utils/index.js.map +1 -0
  26. package/cjs/structures/path/utils/indexTrim.js +17 -0
  27. package/cjs/structures/path/utils/indexTrim.js.map +1 -0
  28. package/cjs/structures/path/utils/optionals.js +11 -0
  29. package/cjs/structures/path/utils/optionals.js.map +1 -0
  30. package/esm/functions/disposer.js +7 -0
  31. package/esm/functions/disposer.js.map +1 -1
  32. package/esm/logger/buffered/buffered.memory.js +13 -1
  33. package/esm/logger/buffered/buffered.memory.js.map +1 -1
  34. package/esm/logger/loggable.js +1 -1
  35. package/esm/logger/loggable.js.map +1 -1
  36. package/esm/math/object/helpers.js +1 -1
  37. package/esm/math/object/helpers.js.map +1 -1
  38. package/esm/math/object/math.composite.js.map +1 -1
  39. package/esm/math/object/math.js +1 -1
  40. package/esm/math/object/math.js.map +1 -1
  41. package/esm/math/object/ops.composite.js +1 -1
  42. package/esm/math/object/ops.composite.js.map +1 -1
  43. package/esm/math/object/ops.js +4 -3
  44. package/esm/math/object/ops.js.map +1 -1
  45. package/esm/structures/path/builder.helpers.js +1 -1
  46. package/esm/structures/path/builder.helpers.js.map +1 -1
  47. package/esm/structures/path/builder.js +1 -1
  48. package/esm/structures/path/builder.js.map +1 -1
  49. package/esm/structures/path/index.js +1 -1
  50. package/esm/structures/path/index.js.map +1 -1
  51. package/esm/structures/path/{utils.js → utils/combineUrls.js} +2 -14
  52. package/esm/structures/path/utils/combineUrls.js.map +1 -0
  53. package/esm/structures/path/utils/index.js +4 -0
  54. package/esm/structures/path/utils/index.js.map +1 -0
  55. package/esm/structures/path/utils/indexTrim.js +14 -0
  56. package/esm/structures/path/utils/indexTrim.js.map +1 -0
  57. package/esm/structures/path/utils/optionals.js +8 -0
  58. package/esm/structures/path/utils/optionals.js.map +1 -0
  59. package/package.json +7 -1
  60. package/tsconfig.cjs.tsbuildinfo +1 -1
  61. package/tsconfig.esm.tsbuildinfo +1 -1
  62. package/tsconfig.types.tsbuildinfo +1 -1
  63. package/types/functions/disposer.d.ts +2 -0
  64. package/types/logger/buffered/buffered.memory.d.ts +2 -0
  65. package/types/math/object/helpers.d.ts +5 -4
  66. package/types/math/object/math.composite.d.ts +9 -9
  67. package/types/math/object/math.d.ts +13 -12
  68. package/types/math/object/ops.composite.d.ts +6 -6
  69. package/types/math/object/ops.d.ts +8 -8
  70. package/types/math/object/types.d.ts +14 -14
  71. package/types/models/LogicModel.d.ts +1 -1
  72. package/types/structures/path/index.d.ts +1 -1
  73. package/types/structures/path/types.d.ts +1 -1
  74. package/types/structures/path/{utils.d.ts → utils/combineUrls.d.ts} +1 -2
  75. package/types/structures/path/utils/index.d.ts +3 -0
  76. package/types/structures/path/utils/indexTrim.d.ts +1 -0
  77. package/types/structures/path/utils/optionals.d.ts +2 -0
  78. package/types/types/misc.d.ts +3 -3
  79. package/cjs/structures/path/utils.js.map +0 -1
  80. package/esm/structures/path/utils.js.map +0 -1
@@ -1,26 +1,26 @@
1
- import type { AnyObject, DeepReadonly, TypedKeys } from '../../types/index.js';
1
+ import type { AnyObject, DeepReadonly, Nullable, TypedKeys } from '../../types/index.js';
2
2
  export type NumKey<T extends AnyObject> = TypedKeys<T, number>;
3
3
  export type AbsOptions = false | 'remove' | 'zero';
4
4
  export type RoundOptions = 'floor' | 'ceil' | 'round';
5
5
  export type DELETE_TYPE = 'delete';
6
6
  export interface IObjectOps<T extends AnyObject> {
7
7
  readonly Empty: Readonly<T>;
8
- isEmpty(o: DeepReadonly<T>): boolean;
8
+ isEmpty(o: Nullable<DeepReadonly<T>>): boolean;
9
9
  getEmpty(): T;
10
- clone(o: DeepReadonly<T>): T;
11
- isValid(o: DeepReadonly<T>): boolean;
12
- isEquals(a: DeepReadonly<T>, b: DeepReadonly<T>): boolean;
13
- assign(to: T, other: DeepReadonly<T>): void;
10
+ clone(o: Nullable<DeepReadonly<T>>): T;
11
+ isValid(o: Nullable<DeepReadonly<T>>): boolean;
12
+ isEquals(a: Nullable<DeepReadonly<T>>, b: Nullable<DeepReadonly<T>>): boolean;
13
+ assign(to: T, other: Nullable<DeepReadonly<T>>): void;
14
14
  }
15
15
  export interface IObjectMath<T extends AnyObject> extends IObjectOps<T> {
16
- contains(base: DeepReadonly<T>, target: DeepReadonly<T>): boolean;
17
- inverse(o: DeepReadonly<T>): T;
18
- abs(o: DeepReadonly<T>, options?: AbsOptions): T | null;
19
- round(o: DeepReadonly<T>, options?: RoundOptions): T | null;
20
- add(o1: DeepReadonly<T>, o2: DeepReadonly<T>): T;
21
- subtract(base: DeepReadonly<T>, amount: DeepReadonly<T> | number): T;
22
- multiply(o1: DeepReadonly<T>, o2: DeepReadonly<T> | number): T;
23
- div(o1: DeepReadonly<T>, o2: DeepReadonly<T> | number): number;
16
+ contains(base: Nullable<DeepReadonly<T>>, target: Nullable<DeepReadonly<T>>): boolean;
17
+ inverse(o: Nullable<DeepReadonly<T>>): T;
18
+ abs(o: Nullable<DeepReadonly<T>>, options?: AbsOptions): T | null;
19
+ round(o: Nullable<DeepReadonly<T>>, options?: RoundOptions): T | null;
20
+ add(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T>>): T;
21
+ subtract(base: Nullable<DeepReadonly<T>>, amount: Nullable<DeepReadonly<T> | number>): T;
22
+ multiply(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T> | number>): T;
23
+ div(o1: Nullable<DeepReadonly<T>>, o2: Nullable<DeepReadonly<T> | number>): number;
24
24
  }
25
25
  export type BasePair<T extends AnyObject, TKey extends string & keyof T = string & keyof T, TOps extends IObjectOps<T[TKey]> = IObjectOps<T[TKey]>> = {
26
26
  key: TKey;
@@ -5,7 +5,7 @@ import { Loggable } from '../logger/loggable.js';
5
5
  export type ActionRunOptions = {
6
6
  /** Action name, required for logging and joining. */
7
7
  name?: string;
8
- /** If set to truthy, will not start an action if another is still in progress.
8
+ /** If set to truthy, will not start this action if another is still in progress.
9
9
  * Additionally, if set to 'throw', will throw an error. Otherwise, will return undefined.
10
10
  *
11
11
  * Note: if a current action runs in an exclusive mode, but the next one is not, the next one will still be allowed.
@@ -1,2 +1,2 @@
1
- export * from './utils.js';
1
+ export * from './utils/index.js';
2
2
  export * as Path from './builder.js';
@@ -1,6 +1,6 @@
1
1
  import type { EmptyObject, Expand, IsNever, LengthArray, Nullable } from '../../types/misc.js';
2
2
  import type { ArgValue, IsOptional, ReadonlyArrayNormalized, TemplateTransform, ToOptionalArray, ToRequired, ToRequiredArray, TransformMap } from './types.helpers.js';
3
- import type { CombineOptions } from './utils.js';
3
+ import type { CombineOptions } from './utils/combineUrls.js';
4
4
  export type ObjectBuilderArgs<TArgs extends string, TFallback = EmptyObject> = string extends TArgs ? TFallback : ArgRecord<TArgs>;
5
5
  export type BuilderArgs<TArgs extends string, L extends number = number> = LengthArray<ArgValue | null, L> | ArgRecord<TArgs>;
6
6
  export type ArgRecord<T extends string> = Expand<{
@@ -1,5 +1,4 @@
1
- import type { Nullable } from '../../types/misc.js';
2
- export declare function indexTrim(str: string | null | undefined, ch: string): string;
1
+ import type { Nullable } from '../../../types/misc.js';
3
2
  export type CombineOptions = {
4
3
  noTrim?: boolean;
5
4
  addTrail?: boolean | string;
@@ -0,0 +1,3 @@
1
+ export * from './indexTrim.js';
2
+ export * from './combineUrls.js';
3
+ export * from './optionals.js';
@@ -0,0 +1 @@
1
+ export declare function indexTrim(str: string | null | undefined, ch: string): string;
@@ -0,0 +1,2 @@
1
+ /** Reformats path from format `'/foo/bar?'` to `'/foo{/bar}'`, according to the latest `path-to-regex` lib rules */
2
+ export declare function replaceOptionalParts(pathname: string): string;
@@ -1,11 +1,11 @@
1
1
  export type Predicate<T> = (value: T) => boolean;
2
2
  /** Type for extracting only string keys from T (skips number & symbol keys) */
3
- export type StringKeys<T extends AnyObject> = {
3
+ export type StringKeys<T extends AnyObject> = Exclude<{
4
4
  [K in keyof T]: K extends string ? K : never;
5
- }[keyof T];
5
+ }[keyof T], undefined | null>;
6
6
  /** Type for extracting string keys of type `T` values of each are of certain type `K` */
7
7
  export type TypedKeys<T extends AnyObject, K> = {
8
- [P in StringKeys<T>]: T[P] extends K ? P : never;
8
+ [P in StringKeys<T>]: T[P] extends (K | undefined) ? P : never;
9
9
  }[StringKeys<T>];
10
10
  /** Type for extraction only keys, values of which are functions with certain args and return result */
11
11
  export type FunctionKeys<T extends AnyObject, TArgs extends any[] = any[], TRes = any> = TypedKeys<T, (...args: TArgs) => TRes>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/structures/path/utils.ts"],"names":[],"mappings":";;;AAEA,8BAgBC;AAoBD,kCAgDC;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