@tolki/utils 1.4.0 → 1.6.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/sorting.js CHANGED
@@ -1,18 +1,32 @@
1
- import { compareValues as f } from "./equality.js";
2
- import { isFunction as e, isArray as a, isUndefined as g } from "./guards.js";
3
- function y(o) {
4
- return function(r, c) {
5
- if (e(r))
6
- return r;
7
- if (a(r) && e(r[0]))
8
- return r[0];
9
- const [t, n] = a(r) ? r : [r, void 0], u = g(n) || n === !0 || n === "asc" || n === "Ascending", m = c || !u;
10
- return (s, d) => {
11
- const i = f(o(s, t), o(d, t));
12
- return m ? -i : i;
1
+ import { phpIntCast as g } from "./cast.js";
2
+ import { compareValues as C } from "./equality.js";
3
+ import { isArray as a, isFunction as S, isUndefined as h, isBoolean as A, isNumber as l } from "./guards.js";
4
+ function B(r) {
5
+ return function(n, t) {
6
+ if (c(n))
7
+ return n;
8
+ if (a(n) && c(n[0]))
9
+ return n[0];
10
+ const [u, o] = a(n) ? n : [n, void 0], m = h(o) || o === !0 || o === "asc" || o === "Ascending", s = t || !m;
11
+ return (p, d) => {
12
+ const e = C(r(p, u), r(d, u));
13
+ return s ? -e : e;
13
14
  };
14
15
  };
15
16
  }
17
+ function c(r) {
18
+ return S(r);
19
+ }
20
+ function D(r) {
21
+ return (i, n) => {
22
+ const t = r(i, n);
23
+ return t === !1 ? -f(r(n, i)) : f(t);
24
+ };
25
+ }
26
+ function f(r) {
27
+ return A(r) ? r ? 1 : 0 : l(r) ? Math.sign(g(r)) : 0;
28
+ }
16
29
  export {
17
- y as createSortSpecComparator
30
+ B as createSortSpecComparator,
31
+ D as phpSortComparator
18
32
  };
package/dist/utils.js CHANGED
@@ -1,81 +1,102 @@
1
- import { arrayableItems as i, arrayableValues as t, castableToArray as s, cssListItemToString as o, getAccessibleValues as a, normalizeToArray as p, toArrayable as l, toJsonSerializable as n, toJsonable as y, toPhpKeyString as c } from "./cast.js";
2
- import { compareValues as u, looseEqual as b, operatorMatch as h, strictEqual as f } from "./equality.js";
3
- import { ItemNotFoundException as x, MultipleItemsFoundException as S } from "./exceptions.js";
4
- import { isAccessibleData as A, isArray as N, isBoolean as F, isFalsy as I, isFiniteNumber as K, isFloat as d, isFunction as M, isInteger as T, isIterable as V, isMap as j, isNegativeNumber as v, isNonPrimitive as O, isNull as E, isNumber as k, isObject as L, isObjectAny as U, isPhpAccessible as q, isPhpFalsy as w, isPhpNumeric as z, isPlainObject as D, isPositiveNumber as J, isPrimitive as W, isPrototypeObject as B, isSet as C, isString as R, isStringable as G, isSymbol as H, isTruthy as Q, isTruthyObject as X, isUndefined as Y, isWeakMap as Z, isWeakSet as _, objectToString as $, phpValueMatch as ee, phpValueMatcher as re } from "./guards.js";
5
- import { defineKey as te, entriesKeyValue as se, isIntegerLikeKey as oe, isPhpArrayKey as ae, isUnsafeKey as pe, keyedEntries as le, phpArrayKey as ne, reindexIntegerKeys as ye, renumberPhpIntegerKeys as ce } from "./keys.js";
6
- import { resolveSliceRange as ue } from "./range.js";
7
- import { phpTypeName as he, resolveDefault as fe, typeOf as ge } from "./reflect.js";
8
- import { createSortSpecComparator as Se } from "./sorting.js";
9
- import { arrayValueMessage as Ae, lowerFirst as Ne, toLower as Fe, toUpper as Ie, upperFirst as Ke } from "./string.js";
1
+ import { arrayableItems as t, arrayableValues as i, castableToArray as s, cssListItemToString as a, getAccessibleValues as o, normalizeToArray as p, phpIntArgument as n, phpIntCast as l, phpStringCast as y, toArrayable as m, toJsonSerializable as u, toJsonable as c, toPhpKeyString as b } from "./cast.js";
2
+ import { compareValues as g, looseEqual as x, operatorMatch as S, strictEqual as f } from "./equality.js";
3
+ import { InvalidArgumentException as K, ItemNotFoundException as d, MultipleItemsFoundException as P, UnexpectedValueException as A } from "./exceptions.js";
4
+ import { isAccessibleData as E, isArray as M, isBoolean as N, isEnumCase as T, isFalsy as F, isFiniteNumber as O, isFloat as V, isFunction as C, isInteger as j, isIterable as k, isMap as w, isNegativeNumber as L, isNonPrimitive as U, isNull as z, isNumber as D, isObject as R, isObjectAny as q, isPhpAccessible as J, isPhpFalsy as W, isPhpInt as B, isPhpNumeric as G, isPlainObject as H, isPositiveNumber as Q, isPrimitive as X, isPrototypeObject as Y, isSet as Z, isString as _, isStringable as $, isSymbol as ee, isTruthy as re, isTruthyObject as te, isUndefined as ie, isWeakMap as se, isWeakSet as ae, objectToString as oe, phpValueMatch as pe, phpValueMatcher as ne } from "./guards.js";
5
+ import { arrayKeyExistsError as ye, defineKey as me, deleteMapKey as ue, entriesKeyValue as ce, hasOwnToString as be, isIllegalOffset as he, isIntegerLikeKey as ge, isPhpArrayKey as xe, isUnsafeKey as Se, keyedEntries as fe, nextIntegerKey as Ie, phpArrayKey as Ke, phpComputedKey as de, readMapKey as Pe, reindexIntegerKeys as Ae, renumberPhpIntegerKeys as ve, writeMapKey as Ee } from "./keys.js";
6
+ import { resolvePadLength as Ne, resolveRangeSize as Te, resolveSliceRange as Fe, resolveSpliceRange as Oe, resolveTakeCount as Ve } from "./range.js";
7
+ import { phpDebugType as je, phpTypeName as ke, resolveDefault as we, typeOf as Le } from "./reflect.js";
8
+ import { createSortSpecComparator as ze, phpSortComparator as De } from "./sorting.js";
9
+ import { arrayValueMessage as qe, lowerFirst as Je, toLower as We, toUpper as Be, upperFirst as Ge } from "./string.js";
10
10
  export {
11
- x as ItemNotFoundException,
12
- S as MultipleItemsFoundException,
13
- Ae as arrayValueMessage,
14
- i as arrayableItems,
15
- t as arrayableValues,
11
+ K as InvalidArgumentException,
12
+ d as ItemNotFoundException,
13
+ P as MultipleItemsFoundException,
14
+ A as UnexpectedValueException,
15
+ ye as arrayKeyExistsError,
16
+ qe as arrayValueMessage,
17
+ t as arrayableItems,
18
+ i as arrayableValues,
16
19
  s as castableToArray,
17
- u as compareValues,
18
- Se as createSortSpecComparator,
19
- o as cssListItemToString,
20
- te as defineKey,
21
- se as entriesKeyValue,
22
- a as getAccessibleValues,
23
- A as isAccessibleData,
24
- N as isArray,
25
- F as isBoolean,
26
- I as isFalsy,
27
- K as isFiniteNumber,
28
- d as isFloat,
29
- M as isFunction,
30
- T as isInteger,
31
- oe as isIntegerLikeKey,
32
- V as isIterable,
33
- j as isMap,
34
- v as isNegativeNumber,
35
- O as isNonPrimitive,
36
- E as isNull,
37
- k as isNumber,
38
- L as isObject,
39
- U as isObjectAny,
40
- q as isPhpAccessible,
41
- ae as isPhpArrayKey,
42
- w as isPhpFalsy,
43
- z as isPhpNumeric,
44
- D as isPlainObject,
45
- J as isPositiveNumber,
46
- W as isPrimitive,
47
- B as isPrototypeObject,
48
- C as isSet,
49
- R as isString,
50
- G as isStringable,
51
- H as isSymbol,
52
- Q as isTruthy,
53
- X as isTruthyObject,
54
- Y as isUndefined,
55
- pe as isUnsafeKey,
56
- Z as isWeakMap,
57
- _ as isWeakSet,
58
- le as keyedEntries,
59
- b as looseEqual,
60
- Ne as lowerFirst,
20
+ g as compareValues,
21
+ ze as createSortSpecComparator,
22
+ a as cssListItemToString,
23
+ me as defineKey,
24
+ ue as deleteMapKey,
25
+ ce as entriesKeyValue,
26
+ o as getAccessibleValues,
27
+ be as hasOwnToString,
28
+ E as isAccessibleData,
29
+ M as isArray,
30
+ N as isBoolean,
31
+ T as isEnumCase,
32
+ F as isFalsy,
33
+ O as isFiniteNumber,
34
+ V as isFloat,
35
+ C as isFunction,
36
+ he as isIllegalOffset,
37
+ j as isInteger,
38
+ ge as isIntegerLikeKey,
39
+ k as isIterable,
40
+ w as isMap,
41
+ L as isNegativeNumber,
42
+ U as isNonPrimitive,
43
+ z as isNull,
44
+ D as isNumber,
45
+ R as isObject,
46
+ q as isObjectAny,
47
+ J as isPhpAccessible,
48
+ xe as isPhpArrayKey,
49
+ W as isPhpFalsy,
50
+ B as isPhpInt,
51
+ G as isPhpNumeric,
52
+ H as isPlainObject,
53
+ Q as isPositiveNumber,
54
+ X as isPrimitive,
55
+ Y as isPrototypeObject,
56
+ Z as isSet,
57
+ _ as isString,
58
+ $ as isStringable,
59
+ ee as isSymbol,
60
+ re as isTruthy,
61
+ te as isTruthyObject,
62
+ ie as isUndefined,
63
+ Se as isUnsafeKey,
64
+ se as isWeakMap,
65
+ ae as isWeakSet,
66
+ fe as keyedEntries,
67
+ x as looseEqual,
68
+ Je as lowerFirst,
69
+ Ie as nextIntegerKey,
61
70
  p as normalizeToArray,
62
- $ as objectToString,
63
- h as operatorMatch,
64
- ne as phpArrayKey,
65
- he as phpTypeName,
66
- ee as phpValueMatch,
67
- re as phpValueMatcher,
68
- ye as reindexIntegerKeys,
69
- ce as renumberPhpIntegerKeys,
70
- fe as resolveDefault,
71
- ue as resolveSliceRange,
71
+ oe as objectToString,
72
+ S as operatorMatch,
73
+ Ke as phpArrayKey,
74
+ de as phpComputedKey,
75
+ je as phpDebugType,
76
+ n as phpIntArgument,
77
+ l as phpIntCast,
78
+ De as phpSortComparator,
79
+ y as phpStringCast,
80
+ ke as phpTypeName,
81
+ pe as phpValueMatch,
82
+ ne as phpValueMatcher,
83
+ Pe as readMapKey,
84
+ Ae as reindexIntegerKeys,
85
+ ve as renumberPhpIntegerKeys,
86
+ we as resolveDefault,
87
+ Ne as resolvePadLength,
88
+ Te as resolveRangeSize,
89
+ Fe as resolveSliceRange,
90
+ Oe as resolveSpliceRange,
91
+ Ve as resolveTakeCount,
72
92
  f as strictEqual,
73
- l as toArrayable,
74
- n as toJsonSerializable,
75
- y as toJsonable,
76
- Fe as toLower,
77
- c as toPhpKeyString,
78
- Ie as toUpper,
79
- ge as typeOf,
80
- Ke as upperFirst
93
+ m as toArrayable,
94
+ u as toJsonSerializable,
95
+ c as toJsonable,
96
+ We as toLower,
97
+ b as toPhpKeyString,
98
+ Be as toUpper,
99
+ Le as typeOf,
100
+ Ge as upperFirst,
101
+ Ee as writeMapKey
81
102
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/utils",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "A set of utility functions for the @tolki packages.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "type": "module",
16
16
  "main": "dist/index.js",
17
17
  "dependencies": {
18
- "@tolki/types": "^1.7.0"
18
+ "@tolki/types": "^1.9.0"
19
19
  },
20
20
  "sideEffects": false,
21
21
  "files": [