solid-new-bucket 0.0.1 → 0.0.2

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.
@@ -0,0 +1,152 @@
1
+ import { Accessor, SignalOptions, Context } from 'solid-js';
2
+
3
+ /**
4
+ * Filter out and remove elements from array.
5
+ * @param arr array
6
+ * @param filter filter
7
+ * @returns new array
8
+ */
9
+ declare function removeElementsFromArray<T>(arr: T[], filter: (t: T) => boolean): T[];
10
+ /**
11
+ * Copy range or array.
12
+ * @param arr array
13
+ * @param start start pos
14
+ * @param end end pos
15
+ * @returns sub range of array
16
+ */
17
+ declare function copyOfRange<T>(arr: T[], start: number, end: number): T[];
18
+ /**
19
+ * Find first element in array which passes test.
20
+ * @param arr array
21
+ * @param test test
22
+ * @returns index
23
+ */
24
+ declare function indexOf<T>(arr: T[], test: Func<T, boolean>): number;
25
+
26
+ /**
27
+ * Stamped Bucket help to trigger rerendering after updating object without recreate new object.
28
+ * @returns StampedBucket<T>
29
+ */
30
+ declare function stampedBucket<T>(value: T, options?: {
31
+ beforeUpdate?: (value: T) => void;
32
+ afterUpdate?: (value: T) => void;
33
+ localStorageName?: string;
34
+ }): StampedBucket<T>;
35
+ declare function asBucket<O, FieldType, DecadeType>(s: StampedBucket<O>, path: ObjectIndex[], mapper?: Mapper<FieldType, DecadeType>): Bucket<FieldType>;
36
+ declare function asAccessor<T, K extends (keyof T)>(v: T | Accessor<T>, k: K): Accessor<T[K]>;
37
+ /**
38
+ * Create a bucket to track data.
39
+ * @param value value or Accessor of value
40
+ * @param options options
41
+ * @returns Bucket<T>
42
+ */
43
+ declare function bucket<T>(value: T | Accessor<T>, options?: {
44
+ useValueAsAccessor?: boolean;
45
+ beforeUpdate?: (newValue: T) => void;
46
+ afterUpdate?: (newValue: T) => void;
47
+ localStorageName?: string;
48
+ } & SignalOptions<T>): Bucket<T>;
49
+
50
+ /**
51
+ * Check if array or string is not empty.
52
+ * @param v array of any, string or undefined
53
+ * @returns true if target is not empty
54
+ */
55
+ declare function isNotEmpty<T>(v?: T[]): boolean;
56
+ declare function isNotEmpty(v?: string): boolean;
57
+ /**
58
+ * Check if value is number.
59
+ * @param v any
60
+ * @returns true if value is number
61
+ */
62
+ declare function isNumber(v: any): boolean;
63
+ /**
64
+ * Compare two date string.
65
+ * @param a date 1
66
+ * @param b date 2
67
+ * @returns true if a is later than b
68
+ */
69
+ declare function compareDateString(a: string, b: string): number;
70
+ /**
71
+ * Check whether there is an element in b exists in a as well.
72
+ * @param a array 1
73
+ * @param b array 2
74
+ * @returns boolean
75
+ */
76
+ declare function containsAny(a: any[], b: any[]): boolean;
77
+
78
+ /**
79
+ * Parse and format timestamp from number to string.
80
+ * @param timestamp time
81
+ * @param showTime show only date if false
82
+ * @param showMilliseconds show ms if true
83
+ * @returns formatted string
84
+ */
85
+ declare function parseTimestamp(timestamp: number, showTime?: boolean, showMilliseconds?: boolean): string;
86
+ declare function toCapital(v: string): string;
87
+
88
+ /**
89
+ * Genereate a sequence.
90
+ * @param start start
91
+ * @param end end
92
+ * @param step step
93
+ * @returns array
94
+ */
95
+ declare function sequence(start: number, end: number, step?: number): number[];
96
+ /**
97
+ * Generate a array of size.
98
+ * @param size size
99
+ * @returns
100
+ */
101
+ declare function iterate(size: number): number[];
102
+
103
+ declare function useCtx<T>(c: Context<T>): T;
104
+ declare function names(...v: (string | undefined)[]): string;
105
+ declare function clone(obj: any): any;
106
+
107
+ declare function wrapDateNumber(v: number, bits?: number): string | number;
108
+ declare function wrapString(v: any): string;
109
+ declare function wrapNumber(v: any): number;
110
+
111
+ /**
112
+ * Invoke function or return value if condition is true.
113
+ * @param condition any
114
+ * @param value function to be invoked or value to be return
115
+ * @param defaultValue fallback value, optional
116
+ */
117
+ declare function conditional<T>(condition: any, value: () => void): void;
118
+ declare function conditional<T>(condition: any, value: T, defaultValue?: T): T;
119
+ declare function conditional<T>(condition: any, value: Supplier<T>, defaultValue?: T): T;
120
+
121
+ declare global {
122
+ type Pair<K, V> = [key: K, value: V];
123
+ type Consumer<T> = (v: T) => void;
124
+ type BiConsumer<A, B> = (a: A, b: B) => void;
125
+ type TriConsumer<A, B, C> = (a: A, b: B, c: C) => void;
126
+ type Func<T, R> = (v: T) => R;
127
+ type BiFunc<A, B, R> = (a: A, b: B) => R;
128
+ type Callback = (...args: any) => any;
129
+ type Supplier<T> = () => T;
130
+ type Comparator<T> = (a: T, b: T) => -1 | 0 | 1;
131
+ type ObjectIndex = string | number;
132
+ interface Mapper<A, B> {
133
+ to?(a: A): B;
134
+ from?(b: B): A;
135
+ }
136
+ type Bucket<T> = {
137
+ <U extends T>(v?: T): U;
138
+ <U extends T>(v: (prev: T) => U): U;
139
+ };
140
+ type StampedBucket<T> = ((updater?: Consumer<T>) => T) & StampedBucketAction<T>;
141
+ interface StampedBucketAction<T> {
142
+ map<O>(call: (v: T) => O): O;
143
+ markChanged(): void;
144
+ reset(v: T): void;
145
+ }
146
+ interface StampedData<T> {
147
+ data: T;
148
+ timestamp: number;
149
+ }
150
+ }
151
+
152
+ export { asAccessor, asBucket, bucket, clone, compareDateString, conditional, containsAny, copyOfRange, indexOf, isNotEmpty, isNumber, iterate, names, parseTimestamp, removeElementsFromArray, sequence, stampedBucket, toCapital, useCtx, wrapDateNumber, wrapNumber, wrapString };
@@ -0,0 +1,152 @@
1
+ import { Accessor, SignalOptions, Context } from 'solid-js';
2
+
3
+ /**
4
+ * Filter out and remove elements from array.
5
+ * @param arr array
6
+ * @param filter filter
7
+ * @returns new array
8
+ */
9
+ declare function removeElementsFromArray<T>(arr: T[], filter: (t: T) => boolean): T[];
10
+ /**
11
+ * Copy range or array.
12
+ * @param arr array
13
+ * @param start start pos
14
+ * @param end end pos
15
+ * @returns sub range of array
16
+ */
17
+ declare function copyOfRange<T>(arr: T[], start: number, end: number): T[];
18
+ /**
19
+ * Find first element in array which passes test.
20
+ * @param arr array
21
+ * @param test test
22
+ * @returns index
23
+ */
24
+ declare function indexOf<T>(arr: T[], test: Func<T, boolean>): number;
25
+
26
+ /**
27
+ * Stamped Bucket help to trigger rerendering after updating object without recreate new object.
28
+ * @returns StampedBucket<T>
29
+ */
30
+ declare function stampedBucket<T>(value: T, options?: {
31
+ beforeUpdate?: (value: T) => void;
32
+ afterUpdate?: (value: T) => void;
33
+ localStorageName?: string;
34
+ }): StampedBucket<T>;
35
+ declare function asBucket<O, FieldType, DecadeType>(s: StampedBucket<O>, path: ObjectIndex[], mapper?: Mapper<FieldType, DecadeType>): Bucket<FieldType>;
36
+ declare function asAccessor<T, K extends (keyof T)>(v: T | Accessor<T>, k: K): Accessor<T[K]>;
37
+ /**
38
+ * Create a bucket to track data.
39
+ * @param value value or Accessor of value
40
+ * @param options options
41
+ * @returns Bucket<T>
42
+ */
43
+ declare function bucket<T>(value: T | Accessor<T>, options?: {
44
+ useValueAsAccessor?: boolean;
45
+ beforeUpdate?: (newValue: T) => void;
46
+ afterUpdate?: (newValue: T) => void;
47
+ localStorageName?: string;
48
+ } & SignalOptions<T>): Bucket<T>;
49
+
50
+ /**
51
+ * Check if array or string is not empty.
52
+ * @param v array of any, string or undefined
53
+ * @returns true if target is not empty
54
+ */
55
+ declare function isNotEmpty<T>(v?: T[]): boolean;
56
+ declare function isNotEmpty(v?: string): boolean;
57
+ /**
58
+ * Check if value is number.
59
+ * @param v any
60
+ * @returns true if value is number
61
+ */
62
+ declare function isNumber(v: any): boolean;
63
+ /**
64
+ * Compare two date string.
65
+ * @param a date 1
66
+ * @param b date 2
67
+ * @returns true if a is later than b
68
+ */
69
+ declare function compareDateString(a: string, b: string): number;
70
+ /**
71
+ * Check whether there is an element in b exists in a as well.
72
+ * @param a array 1
73
+ * @param b array 2
74
+ * @returns boolean
75
+ */
76
+ declare function containsAny(a: any[], b: any[]): boolean;
77
+
78
+ /**
79
+ * Parse and format timestamp from number to string.
80
+ * @param timestamp time
81
+ * @param showTime show only date if false
82
+ * @param showMilliseconds show ms if true
83
+ * @returns formatted string
84
+ */
85
+ declare function parseTimestamp(timestamp: number, showTime?: boolean, showMilliseconds?: boolean): string;
86
+ declare function toCapital(v: string): string;
87
+
88
+ /**
89
+ * Genereate a sequence.
90
+ * @param start start
91
+ * @param end end
92
+ * @param step step
93
+ * @returns array
94
+ */
95
+ declare function sequence(start: number, end: number, step?: number): number[];
96
+ /**
97
+ * Generate a array of size.
98
+ * @param size size
99
+ * @returns
100
+ */
101
+ declare function iterate(size: number): number[];
102
+
103
+ declare function useCtx<T>(c: Context<T>): T;
104
+ declare function names(...v: (string | undefined)[]): string;
105
+ declare function clone(obj: any): any;
106
+
107
+ declare function wrapDateNumber(v: number, bits?: number): string | number;
108
+ declare function wrapString(v: any): string;
109
+ declare function wrapNumber(v: any): number;
110
+
111
+ /**
112
+ * Invoke function or return value if condition is true.
113
+ * @param condition any
114
+ * @param value function to be invoked or value to be return
115
+ * @param defaultValue fallback value, optional
116
+ */
117
+ declare function conditional<T>(condition: any, value: () => void): void;
118
+ declare function conditional<T>(condition: any, value: T, defaultValue?: T): T;
119
+ declare function conditional<T>(condition: any, value: Supplier<T>, defaultValue?: T): T;
120
+
121
+ declare global {
122
+ type Pair<K, V> = [key: K, value: V];
123
+ type Consumer<T> = (v: T) => void;
124
+ type BiConsumer<A, B> = (a: A, b: B) => void;
125
+ type TriConsumer<A, B, C> = (a: A, b: B, c: C) => void;
126
+ type Func<T, R> = (v: T) => R;
127
+ type BiFunc<A, B, R> = (a: A, b: B) => R;
128
+ type Callback = (...args: any) => any;
129
+ type Supplier<T> = () => T;
130
+ type Comparator<T> = (a: T, b: T) => -1 | 0 | 1;
131
+ type ObjectIndex = string | number;
132
+ interface Mapper<A, B> {
133
+ to?(a: A): B;
134
+ from?(b: B): A;
135
+ }
136
+ type Bucket<T> = {
137
+ <U extends T>(v?: T): U;
138
+ <U extends T>(v: (prev: T) => U): U;
139
+ };
140
+ type StampedBucket<T> = ((updater?: Consumer<T>) => T) & StampedBucketAction<T>;
141
+ interface StampedBucketAction<T> {
142
+ map<O>(call: (v: T) => O): O;
143
+ markChanged(): void;
144
+ reset(v: T): void;
145
+ }
146
+ interface StampedData<T> {
147
+ data: T;
148
+ timestamp: number;
149
+ }
150
+ }
151
+
152
+ export { asAccessor, asBucket, bucket, clone, compareDateString, conditional, containsAny, copyOfRange, indexOf, isNotEmpty, isNumber, iterate, names, parseTimestamp, removeElementsFromArray, sequence, stampedBucket, toCapital, useCtx, wrapDateNumber, wrapNumber, wrapString };
package/dist/index.js ADDED
@@ -0,0 +1,371 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ asAccessor: () => asAccessor,
24
+ asBucket: () => asBucket,
25
+ bucket: () => bucket,
26
+ clone: () => clone,
27
+ compareDateString: () => compareDateString,
28
+ conditional: () => conditional,
29
+ containsAny: () => containsAny,
30
+ copyOfRange: () => copyOfRange,
31
+ indexOf: () => indexOf,
32
+ isNotEmpty: () => isNotEmpty,
33
+ isNumber: () => isNumber,
34
+ iterate: () => iterate,
35
+ names: () => names,
36
+ parseTimestamp: () => parseTimestamp,
37
+ removeElementsFromArray: () => removeElementsFromArray,
38
+ sequence: () => sequence,
39
+ stampedBucket: () => stampedBucket,
40
+ toCapital: () => toCapital,
41
+ useCtx: () => useCtx,
42
+ wrapDateNumber: () => wrapDateNumber,
43
+ wrapNumber: () => wrapNumber,
44
+ wrapString: () => wrapString
45
+ });
46
+ module.exports = __toCommonJS(src_exports);
47
+
48
+ // src/arrayHelpers.ts
49
+ function removeElementsFromArray(arr, filter) {
50
+ const idx = [];
51
+ arr.forEach((t, i) => {
52
+ if (filter(t)) {
53
+ idx.push(i);
54
+ }
55
+ });
56
+ return idx.map((i) => arr.splice(i, 1)[0]);
57
+ }
58
+ function copyOfRange(arr, start, end) {
59
+ const r = [];
60
+ start = Math.max(0, start);
61
+ end = Math.min(arr.length, end);
62
+ for (let i = start; i < end; i++) {
63
+ r.push(arr[i]);
64
+ }
65
+ return r;
66
+ }
67
+ function indexOf(arr, test) {
68
+ for (let i = 0; i < arr.length; i++) {
69
+ if (test(arr[i])) {
70
+ return i;
71
+ }
72
+ }
73
+ return -1;
74
+ }
75
+
76
+ // src/buckets.ts
77
+ var import_solid_js = require("solid-js");
78
+ function stampedBucket(value, options) {
79
+ if (options?.localStorageName) {
80
+ const raw = localStorage.getItem(options.localStorageName);
81
+ if (raw) {
82
+ value = JSON.parse(raw);
83
+ }
84
+ }
85
+ const [timestamp, setTimestamp] = (0, import_solid_js.createSignal)((/* @__PURE__ */ new Date()).getTime());
86
+ const v = (0, import_solid_js.createMemo)(() => {
87
+ return {
88
+ timestamp: timestamp(),
89
+ data: value,
90
+ markChanged() {
91
+ setTimestamp((/* @__PURE__ */ new Date()).getTime());
92
+ }
93
+ };
94
+ });
95
+ const setV = (newValue) => {
96
+ if (newValue) {
97
+ value = newValue;
98
+ }
99
+ setTimestamp((/* @__PURE__ */ new Date()).getTime());
100
+ };
101
+ const call = function(updater) {
102
+ if (updater) {
103
+ options?.beforeUpdate?.(value);
104
+ updater(value);
105
+ if (options?.localStorageName) {
106
+ localStorage.setItem(options.localStorageName, value ? JSON.stringify(value) : "");
107
+ }
108
+ setV();
109
+ options?.afterUpdate?.(value);
110
+ }
111
+ call.map = (mapper) => {
112
+ return mapper(v().data);
113
+ };
114
+ call.markChanged = () => {
115
+ setTimestamp((/* @__PURE__ */ new Date()).getTime());
116
+ };
117
+ call.reset = (v2) => {
118
+ setV(v2);
119
+ };
120
+ return v().data;
121
+ };
122
+ return call;
123
+ }
124
+ function getFieldOfObject(o, paths) {
125
+ for (let i = 0; i < paths.length - 1; i++) {
126
+ o = o[paths[i]];
127
+ if (!o) {
128
+ throw new Error(`cannot find ${paths.join(".")} in ${o}`);
129
+ }
130
+ }
131
+ return o[paths[paths.length - 1]];
132
+ }
133
+ function setFieldOfObject(o, newValue, paths) {
134
+ for (let i = 0; i < paths.length - 1; i++) {
135
+ o = o[paths[i]];
136
+ if (!o) {
137
+ throw new Error(`cannot find ${paths.join(".")} in ${o}`);
138
+ }
139
+ }
140
+ o[paths[paths.length - 1]] = newValue;
141
+ }
142
+ function asBucket(s, path, mapper) {
143
+ const getField = (data) => {
144
+ let v = getFieldOfObject(data, path);
145
+ return mapper ? mapper.from?.(v) : v;
146
+ };
147
+ const setField = (data, v) => {
148
+ if (mapper) {
149
+ v = mapper.to?.(v);
150
+ }
151
+ setFieldOfObject(data, v, path);
152
+ };
153
+ return (t) => {
154
+ if (t != void 0) {
155
+ s((data) => {
156
+ if (typeof t === "function") {
157
+ const oldValue = getField(data);
158
+ setField(data, t(oldValue));
159
+ } else {
160
+ setField(data, t);
161
+ }
162
+ });
163
+ }
164
+ return getField(s());
165
+ };
166
+ }
167
+ function asAccessor(v, k) {
168
+ return () => {
169
+ if (typeof v === "function") {
170
+ return v()[k];
171
+ }
172
+ return v[k];
173
+ };
174
+ }
175
+ function bucket(value, options) {
176
+ if (options?.useValueAsAccessor && typeof value === "function") {
177
+ const [_, others2] = (0, import_solid_js.splitProps)(options, ["useValueAsAccessor"]);
178
+ const memo = (0, import_solid_js.createMemo)(() => bucket(value(), others2));
179
+ return (t) => {
180
+ return memo()(t);
181
+ };
182
+ }
183
+ const [local, others] = options && (0, import_solid_js.splitProps)(options, ["beforeUpdate", "afterUpdate", "localStorageName"]) || [];
184
+ if (local?.localStorageName) {
185
+ const raw = localStorage.getItem(local.localStorageName);
186
+ if (raw) {
187
+ value = JSON.parse(raw);
188
+ }
189
+ }
190
+ const [v, setV] = (0, import_solid_js.createSignal)(value, others);
191
+ return (t) => {
192
+ if (t !== void 0) {
193
+ const newValue = setV((prev) => {
194
+ local?.beforeUpdate?.(prev);
195
+ if (typeof t === "function") {
196
+ return t(prev);
197
+ } else {
198
+ return t;
199
+ }
200
+ });
201
+ if (local?.localStorageName) {
202
+ localStorage.setItem(local.localStorageName, t ? JSON.stringify(t) : "");
203
+ }
204
+ local?.afterUpdate?.(newValue);
205
+ return newValue;
206
+ }
207
+ return v();
208
+ };
209
+ }
210
+
211
+ // src/checks.ts
212
+ function isNotEmpty(v) {
213
+ if (!v) return false;
214
+ if (typeof v === "string") {
215
+ return v.length > 0;
216
+ }
217
+ if (typeof v === "object") {
218
+ if (Array.isArray(v)) {
219
+ return v.length > 0;
220
+ }
221
+ return Object.keys(v).length > 0;
222
+ }
223
+ return false;
224
+ }
225
+ function isNumber(v) {
226
+ return typeof v === "number";
227
+ }
228
+ function compareDateString(a, b) {
229
+ return Date.parse(a) - Date.parse(b);
230
+ }
231
+ function containsAny(a, b) {
232
+ for (let i of a) {
233
+ for (let j of b) {
234
+ if (i === j) {
235
+ return true;
236
+ }
237
+ }
238
+ }
239
+ return false;
240
+ }
241
+
242
+ // src/wrappers.ts
243
+ function wrapDateNumber(v, bits = 2) {
244
+ if (v == 0) {
245
+ return "0".repeat(bits);
246
+ }
247
+ let n = v;
248
+ while (n > 0) {
249
+ n = Math.floor(n / 10);
250
+ bits--;
251
+ }
252
+ return bits > 0 ? "0".repeat(bits) + v : v;
253
+ }
254
+ function wrapString(v) {
255
+ if (typeof v === "string") {
256
+ return v;
257
+ }
258
+ return v?.toString() || "";
259
+ }
260
+ function wrapNumber(v) {
261
+ if (typeof v === "number") {
262
+ return v;
263
+ }
264
+ return 0;
265
+ }
266
+
267
+ // src/converters.ts
268
+ function parseTimestamp(timestamp, showTime, showMilliseconds) {
269
+ const date = new Date(timestamp);
270
+ let r = `${wrapDateNumber(date.getFullYear())}-${wrapDateNumber(date.getMonth() + 1)}-${wrapDateNumber(date.getDate())}`;
271
+ if (showTime) {
272
+ r += ` ${wrapDateNumber(date.getHours())}:${wrapDateNumber(date.getMinutes())}:${wrapDateNumber(date.getSeconds())}`;
273
+ }
274
+ if (showMilliseconds) {
275
+ r += `.${wrapDateNumber(date.getMilliseconds(), 3)}`;
276
+ }
277
+ ;
278
+ return r;
279
+ }
280
+ function toCapital(v) {
281
+ return v.charAt(0).toUpperCase() + v.substring(1);
282
+ }
283
+
284
+ // src/generators.ts
285
+ function sequence(start, end, step = 1) {
286
+ const r = [];
287
+ for (let i = start; i < end; i += step) {
288
+ r.push(i);
289
+ }
290
+ return r;
291
+ }
292
+ function iterate(size) {
293
+ return Array.from(Array(size).keys());
294
+ }
295
+
296
+ // src/others.ts
297
+ var import_solid_js2 = require("solid-js");
298
+ function useCtx(c) {
299
+ const context = (0, import_solid_js2.useContext)(c);
300
+ if (!context) {
301
+ throw new Error("cannot find a " + JSON.stringify(c));
302
+ }
303
+ return context;
304
+ }
305
+ function names(...v) {
306
+ return v.filter((name) => Boolean(name)).join(" ");
307
+ }
308
+ function clone(obj) {
309
+ const type = typeof obj;
310
+ switch (type) {
311
+ case "object": {
312
+ let r = Array.isArray(obj) ? [] : {};
313
+ for (let key of Object.keys(obj)) {
314
+ r[key] = clone(obj[key]);
315
+ }
316
+ return r;
317
+ }
318
+ default:
319
+ return obj;
320
+ }
321
+ }
322
+
323
+ // src/conditionals.ts
324
+ function conditional(condition, value, defaultValue) {
325
+ if (typeof value === "function") {
326
+ if (condition) {
327
+ const r = value();
328
+ if (r) {
329
+ return r;
330
+ }
331
+ }
332
+ return defaultValue;
333
+ }
334
+ if (typeof (value === "string")) {
335
+ return condition ? value : defaultValue || "";
336
+ }
337
+ if (typeof value === "number") {
338
+ return condition ? value : defaultValue || 0;
339
+ }
340
+ if (condition) {
341
+ return value;
342
+ } else if (defaultValue !== void 0 && defaultValue !== null) {
343
+ return defaultValue;
344
+ }
345
+ }
346
+ // Annotate the CommonJS export names for ESM import in node:
347
+ 0 && (module.exports = {
348
+ asAccessor,
349
+ asBucket,
350
+ bucket,
351
+ clone,
352
+ compareDateString,
353
+ conditional,
354
+ containsAny,
355
+ copyOfRange,
356
+ indexOf,
357
+ isNotEmpty,
358
+ isNumber,
359
+ iterate,
360
+ names,
361
+ parseTimestamp,
362
+ removeElementsFromArray,
363
+ sequence,
364
+ stampedBucket,
365
+ toCapital,
366
+ useCtx,
367
+ wrapDateNumber,
368
+ wrapNumber,
369
+ wrapString
370
+ });
371
+ //# sourceMappingURL=index.js.map