@naturalcycles/js-lib 14.155.0 → 14.155.1
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/env/buildInfo.d.ts +0 -5
- package/dist/env/buildInfo.js +0 -2
- package/dist/lazy.js +3 -1
- package/dist-esm/env/buildInfo.js +0 -2
- package/dist-esm/lazy.js +3 -1
- package/package.json +2 -2
- package/src/array/array.util.ts +10 -7
- package/src/datetime/dateInterval.ts +4 -1
- package/src/datetime/localDate.ts +5 -1
- package/src/datetime/timeInterval.ts +4 -1
- package/src/decorators/debounce.ts +11 -11
- package/src/env/buildInfo.ts +0 -9
- package/src/json-schema/jsonSchemaBuilder.ts +25 -25
- package/src/lazy.ts +2 -1
- package/src/math/sma.ts +4 -1
- package/src/object/deepEquals.ts +3 -3
- package/src/object/object.util.ts +17 -11
- package/src/promise/pMap.ts +1 -1
- package/src/seq/seq.ts +8 -2
- package/src/string/readingTime.ts +1 -1
- package/src/zod/zod.util.ts +5 -1
package/dist/env/buildInfo.d.ts
CHANGED
|
@@ -8,11 +8,6 @@ export interface BuildInfo {
|
|
|
8
8
|
* Unix timestamp of commit ("committer date", not "author date")
|
|
9
9
|
*/
|
|
10
10
|
tsCommit: UnixTimestampNumber;
|
|
11
|
-
/**
|
|
12
|
-
* Human-readable time of the build. E.g:
|
|
13
|
-
* 2019-06-21 18:35:19
|
|
14
|
-
*/
|
|
15
|
-
tsStr: string;
|
|
16
11
|
repoName: string;
|
|
17
12
|
branchName: string;
|
|
18
13
|
/**
|
package/dist/env/buildInfo.js
CHANGED
|
@@ -5,7 +5,6 @@ const localTime_1 = require("../datetime/localTime");
|
|
|
5
5
|
function generateBuildInfoDev() {
|
|
6
6
|
const now = (0, localTime_1.localTime)();
|
|
7
7
|
const ts = now.unix();
|
|
8
|
-
const tsStr = now.toPretty();
|
|
9
8
|
const rev = 'devRev';
|
|
10
9
|
const branchName = 'devBranch';
|
|
11
10
|
const repoName = 'devRepo';
|
|
@@ -14,7 +13,6 @@ function generateBuildInfoDev() {
|
|
|
14
13
|
return {
|
|
15
14
|
ts,
|
|
16
15
|
tsCommit,
|
|
17
|
-
tsStr,
|
|
18
16
|
repoName,
|
|
19
17
|
branchName,
|
|
20
18
|
rev,
|
package/dist/lazy.js
CHANGED
|
@@ -37,7 +37,9 @@ exports._lazyValue = _lazyValue;
|
|
|
37
37
|
* Based on: https://github.com/sindresorhus/define-lazy-prop
|
|
38
38
|
*/
|
|
39
39
|
function _defineLazyProperty(obj, propertyName, fn) {
|
|
40
|
-
const define = (value) =>
|
|
40
|
+
const define = (value) => {
|
|
41
|
+
Object.defineProperty(obj, propertyName, { value, enumerable: true, writable: true });
|
|
42
|
+
};
|
|
41
43
|
Object.defineProperty(obj, propertyName, {
|
|
42
44
|
configurable: true,
|
|
43
45
|
enumerable: true,
|
|
@@ -2,7 +2,6 @@ import { localTime } from '../datetime/localTime';
|
|
|
2
2
|
export function generateBuildInfoDev() {
|
|
3
3
|
const now = localTime();
|
|
4
4
|
const ts = now.unix();
|
|
5
|
-
const tsStr = now.toPretty();
|
|
6
5
|
const rev = 'devRev';
|
|
7
6
|
const branchName = 'devBranch';
|
|
8
7
|
const repoName = 'devRepo';
|
|
@@ -11,7 +10,6 @@ export function generateBuildInfoDev() {
|
|
|
11
10
|
return {
|
|
12
11
|
ts,
|
|
13
12
|
tsCommit,
|
|
14
|
-
tsStr,
|
|
15
13
|
repoName,
|
|
16
14
|
branchName,
|
|
17
15
|
rev,
|
package/dist-esm/lazy.js
CHANGED
|
@@ -33,7 +33,9 @@ export function _lazyValue(fn) {
|
|
|
33
33
|
* Based on: https://github.com/sindresorhus/define-lazy-prop
|
|
34
34
|
*/
|
|
35
35
|
export function _defineLazyProperty(obj, propertyName, fn) {
|
|
36
|
-
const define = (value) =>
|
|
36
|
+
const define = (value) => {
|
|
37
|
+
Object.defineProperty(obj, propertyName, { value, enumerable: true, writable: true });
|
|
38
|
+
};
|
|
37
39
|
Object.defineProperty(obj, propertyName, {
|
|
38
40
|
configurable: true,
|
|
39
41
|
enumerable: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/js-lib",
|
|
3
|
-
"version": "14.155.
|
|
3
|
+
"version": "14.155.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install",
|
|
6
6
|
"build-prod": "build-prod-esm-cjs",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@types/node": "^20.1.0",
|
|
21
21
|
"crypto-js": "^4.1.1",
|
|
22
22
|
"jest": "^29.0.0",
|
|
23
|
-
"prettier": "^
|
|
23
|
+
"prettier": "^3.0.0",
|
|
24
24
|
"rxjs": "^7.0.1",
|
|
25
25
|
"vuepress": "^1.7.1",
|
|
26
26
|
"vuepress-plugin-typescript": "^0.3.1"
|
package/src/array/array.util.ts
CHANGED
|
@@ -97,13 +97,16 @@ export function _by<T>(items: readonly T[], mapper: Mapper<T, any>): StringMap<T
|
|
|
97
97
|
* Returning `undefined` from the Mapper will EXCLUDE the item.
|
|
98
98
|
*/
|
|
99
99
|
export function _groupBy<T>(items: readonly T[], mapper: Mapper<T, any>): StringMap<T[]> {
|
|
100
|
-
return items.reduce(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
return items.reduce(
|
|
101
|
+
(map, item, index) => {
|
|
102
|
+
const res = mapper(item, index)
|
|
103
|
+
if (res !== undefined) {
|
|
104
|
+
map[res] = [...(map[res] || []), item]
|
|
105
|
+
}
|
|
106
|
+
return map
|
|
107
|
+
},
|
|
108
|
+
{} as StringMap<T[]>,
|
|
109
|
+
)
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
/**
|
|
@@ -10,7 +10,10 @@ export type DateIntervalString = string
|
|
|
10
10
|
* @experimental
|
|
11
11
|
*/
|
|
12
12
|
export class DateInterval {
|
|
13
|
-
private constructor(
|
|
13
|
+
private constructor(
|
|
14
|
+
public start: LocalDate,
|
|
15
|
+
public end: LocalDate,
|
|
16
|
+
) {}
|
|
14
17
|
|
|
15
18
|
static of(start: LocalDateConfig, end: LocalDateConfig): DateInterval {
|
|
16
19
|
return new DateInterval(LocalDate.of(start), LocalDate.of(end))
|
|
@@ -21,7 +21,11 @@ export type LocalDateFormatter = (ld: LocalDate) => string
|
|
|
21
21
|
* @experimental
|
|
22
22
|
*/
|
|
23
23
|
export class LocalDate {
|
|
24
|
-
private constructor(
|
|
24
|
+
private constructor(
|
|
25
|
+
private $year: number,
|
|
26
|
+
private $month: number,
|
|
27
|
+
private $day: number,
|
|
28
|
+
) {}
|
|
25
29
|
|
|
26
30
|
static create(year: number, month: number, day: number): LocalDate {
|
|
27
31
|
return new LocalDate(year, month, day)
|
|
@@ -13,7 +13,10 @@ export type TimeIntervalString = string
|
|
|
13
13
|
* @experimental
|
|
14
14
|
*/
|
|
15
15
|
export class TimeInterval {
|
|
16
|
-
private constructor(
|
|
16
|
+
private constructor(
|
|
17
|
+
private $start: UnixTimestampNumber,
|
|
18
|
+
private $end: UnixTimestampNumber,
|
|
19
|
+
) {}
|
|
17
20
|
|
|
18
21
|
static of(start: LocalTimeConfig, end: LocalTimeConfig): TimeInterval {
|
|
19
22
|
return new TimeInterval(
|
|
@@ -51,7 +51,7 @@ export function _debounce<T extends AnyFunction>(
|
|
|
51
51
|
const { leading = false, trailing = true } = opt
|
|
52
52
|
const maxWait = maxing ? Math.max(Number(opt.maxWait) || 0, wait) : opt.maxWait
|
|
53
53
|
|
|
54
|
-
function invokeFunc(time: number) {
|
|
54
|
+
function invokeFunc(time: number): any {
|
|
55
55
|
const args = lastArgs
|
|
56
56
|
const thisArg = lastThis
|
|
57
57
|
|
|
@@ -65,11 +65,11 @@ export function _debounce<T extends AnyFunction>(
|
|
|
65
65
|
return setTimeout(pendingFunc, wait) as any
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
function cancelTimer(id: number) {
|
|
68
|
+
function cancelTimer(id: number): void {
|
|
69
69
|
clearTimeout(id)
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
function leadingEdge(time: number) {
|
|
72
|
+
function leadingEdge(time: number): any {
|
|
73
73
|
// Reset any `maxWait` timer.
|
|
74
74
|
lastInvokeTime = time
|
|
75
75
|
// Start the timer for the trailing edge.
|
|
@@ -78,7 +78,7 @@ export function _debounce<T extends AnyFunction>(
|
|
|
78
78
|
return leading ? invokeFunc(time) : result
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function remainingWait(time: number) {
|
|
81
|
+
function remainingWait(time: number): number {
|
|
82
82
|
const timeSinceLastCall = time - lastCallTime!
|
|
83
83
|
const timeSinceLastInvoke = time - lastInvokeTime
|
|
84
84
|
const timeWaiting = wait - timeSinceLastCall
|
|
@@ -86,7 +86,7 @@ export function _debounce<T extends AnyFunction>(
|
|
|
86
86
|
return maxing ? Math.min(timeWaiting, maxWait! - timeSinceLastInvoke) : timeWaiting
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
function shouldInvoke(time: number) {
|
|
89
|
+
function shouldInvoke(time: number): boolean {
|
|
90
90
|
const timeSinceLastCall = time - lastCallTime!
|
|
91
91
|
const timeSinceLastInvoke = time - lastInvokeTime
|
|
92
92
|
|
|
@@ -101,7 +101,7 @@ export function _debounce<T extends AnyFunction>(
|
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function timerExpired() {
|
|
104
|
+
function timerExpired(): any {
|
|
105
105
|
const time = Date.now()
|
|
106
106
|
if (shouldInvoke(time)) {
|
|
107
107
|
return trailingEdge(time)
|
|
@@ -110,7 +110,7 @@ export function _debounce<T extends AnyFunction>(
|
|
|
110
110
|
timerId = startTimer(timerExpired, remainingWait(time))
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function trailingEdge(time: number) {
|
|
113
|
+
function trailingEdge(time: number): any {
|
|
114
114
|
timerId = undefined
|
|
115
115
|
|
|
116
116
|
// Only invoke if we have `lastArgs` which means `func` has been
|
|
@@ -122,7 +122,7 @@ export function _debounce<T extends AnyFunction>(
|
|
|
122
122
|
return result
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
function cancel() {
|
|
125
|
+
function cancel(): void {
|
|
126
126
|
if (timerId !== undefined) {
|
|
127
127
|
cancelTimer(timerId)
|
|
128
128
|
}
|
|
@@ -130,15 +130,15 @@ export function _debounce<T extends AnyFunction>(
|
|
|
130
130
|
lastArgs = lastCallTime = lastThis = timerId = undefined
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
function flush() {
|
|
133
|
+
function flush(): any {
|
|
134
134
|
return timerId === undefined ? result : trailingEdge(Date.now())
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
function pending() {
|
|
137
|
+
function pending(): boolean {
|
|
138
138
|
return timerId !== undefined
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
function debounced(this: any, ...args: any[]) {
|
|
141
|
+
function debounced(this: any, ...args: any[]): any {
|
|
142
142
|
const time = Date.now()
|
|
143
143
|
const isInvoking = shouldInvoke(time)
|
|
144
144
|
|
package/src/env/buildInfo.ts
CHANGED
|
@@ -12,12 +12,6 @@ export interface BuildInfo {
|
|
|
12
12
|
*/
|
|
13
13
|
tsCommit: UnixTimestampNumber
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Human-readable time of the build. E.g:
|
|
17
|
-
* 2019-06-21 18:35:19
|
|
18
|
-
*/
|
|
19
|
-
tsStr: string
|
|
20
|
-
|
|
21
15
|
repoName: string
|
|
22
16
|
branchName: string
|
|
23
17
|
|
|
@@ -51,8 +45,6 @@ export interface BuildInfo {
|
|
|
51
45
|
export function generateBuildInfoDev(): BuildInfo {
|
|
52
46
|
const now = localTime()
|
|
53
47
|
const ts = now.unix()
|
|
54
|
-
const tsStr = now.toPretty()
|
|
55
|
-
|
|
56
48
|
const rev = 'devRev'
|
|
57
49
|
const branchName = 'devBranch'
|
|
58
50
|
const repoName = 'devRepo'
|
|
@@ -63,7 +55,6 @@ export function generateBuildInfoDev(): BuildInfo {
|
|
|
63
55
|
return {
|
|
64
56
|
ts,
|
|
65
57
|
tsCommit,
|
|
66
|
-
tsStr,
|
|
67
58
|
repoName,
|
|
68
59
|
branchName,
|
|
69
60
|
rev,
|
|
@@ -242,16 +242,16 @@ export class JsonSchemaNumberBuilder extends JsonSchemaAnyBuilder<number, JsonSc
|
|
|
242
242
|
return this
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
int32 = () => this.format('int32')
|
|
246
|
-
int64 = () => this.format('int64')
|
|
247
|
-
float = () => this.format('float')
|
|
248
|
-
double = () => this.format('double')
|
|
249
|
-
unixTimestamp = () => this.format('unixTimestamp')
|
|
250
|
-
unixTimestamp2000 = () => this.format('unixTimestamp2000')
|
|
251
|
-
unixTimestampMillis = () => this.format('unixTimestampMillis')
|
|
252
|
-
unixTimestampMillis2000 = () => this.format('unixTimestampMillis2000')
|
|
253
|
-
utcOffset = () => this.format('utcOffset')
|
|
254
|
-
utcOffsetHours = () => this.format('utcOffsetHours')
|
|
245
|
+
int32 = (): this => this.format('int32')
|
|
246
|
+
int64 = (): this => this.format('int64')
|
|
247
|
+
float = (): this => this.format('float')
|
|
248
|
+
double = (): this => this.format('double')
|
|
249
|
+
unixTimestamp = (): this => this.format('unixTimestamp')
|
|
250
|
+
unixTimestamp2000 = (): this => this.format('unixTimestamp2000')
|
|
251
|
+
unixTimestampMillis = (): this => this.format('unixTimestampMillis')
|
|
252
|
+
unixTimestampMillis2000 = (): this => this.format('unixTimestampMillis2000')
|
|
253
|
+
utcOffset = (): this => this.format('utcOffset')
|
|
254
|
+
utcOffsetHours = (): this => this.format('utcOffsetHours')
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
export class JsonSchemaStringBuilder extends JsonSchemaAnyBuilder<string, JsonSchemaString> {
|
|
@@ -283,22 +283,22 @@ export class JsonSchemaStringBuilder extends JsonSchemaAnyBuilder<string, JsonSc
|
|
|
283
283
|
return this
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
email = () => this.format('email')
|
|
287
|
-
date = () => this.format('date')
|
|
288
|
-
url = () => this.format('url')
|
|
289
|
-
ipv4 = () => this.format('ipv4')
|
|
290
|
-
ipv6 = () => this.format('ipv6')
|
|
291
|
-
password = () => this.format('password')
|
|
292
|
-
id = () => this.format('id')
|
|
293
|
-
slug = () => this.format('slug')
|
|
294
|
-
semVer = () => this.format('semVer')
|
|
295
|
-
languageTag = () => this.format('languageTag')
|
|
296
|
-
countryCode = () => this.format('countryCode')
|
|
297
|
-
currency = () => this.format('currency')
|
|
286
|
+
email = (): this => this.format('email')
|
|
287
|
+
date = (): this => this.format('date')
|
|
288
|
+
url = (): this => this.format('url')
|
|
289
|
+
ipv4 = (): this => this.format('ipv4')
|
|
290
|
+
ipv6 = (): this => this.format('ipv6')
|
|
291
|
+
password = (): this => this.format('password')
|
|
292
|
+
id = (): this => this.format('id')
|
|
293
|
+
slug = (): this => this.format('slug')
|
|
294
|
+
semVer = (): this => this.format('semVer')
|
|
295
|
+
languageTag = (): this => this.format('languageTag')
|
|
296
|
+
countryCode = (): this => this.format('countryCode')
|
|
297
|
+
currency = (): this => this.format('currency')
|
|
298
298
|
|
|
299
|
-
trim = (trim = true) => this.transformModify('trim', trim)
|
|
300
|
-
toLowerCase = (toLowerCase = true) => this.transformModify('toLowerCase', toLowerCase)
|
|
301
|
-
toUpperCase = (toUpperCase = true) => this.transformModify('toUpperCase', toUpperCase)
|
|
299
|
+
trim = (trim = true): this => this.transformModify('trim', trim)
|
|
300
|
+
toLowerCase = (toLowerCase = true): this => this.transformModify('toLowerCase', toLowerCase)
|
|
301
|
+
toUpperCase = (toUpperCase = true): this => this.transformModify('toUpperCase', toUpperCase)
|
|
302
302
|
|
|
303
303
|
private transformModify(t: 'trim' | 'toLowerCase' | 'toUpperCase', add: boolean): this {
|
|
304
304
|
if (add) {
|
package/src/lazy.ts
CHANGED
|
@@ -42,8 +42,9 @@ export function _defineLazyProperty<OBJ extends AnyObject>(
|
|
|
42
42
|
propertyName: keyof OBJ,
|
|
43
43
|
fn: AnyFunction,
|
|
44
44
|
): OBJ {
|
|
45
|
-
const define = (value: any) =>
|
|
45
|
+
const define = (value: any): void => {
|
|
46
46
|
Object.defineProperty(obj, propertyName, { value, enumerable: true, writable: true })
|
|
47
|
+
}
|
|
47
48
|
|
|
48
49
|
Object.defineProperty(obj, propertyName, {
|
|
49
50
|
configurable: true,
|
package/src/math/sma.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Implements a Simple Moving Average algorithm.
|
|
3
3
|
*/
|
|
4
4
|
export class SimpleMovingAverage {
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(
|
|
6
|
+
public readonly size: number,
|
|
7
|
+
public readonly data: number[] = [],
|
|
8
|
+
) {}
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Next index of array to push to
|
package/src/object/deepEquals.ts
CHANGED
|
@@ -15,7 +15,7 @@ export function _deepEquals(a: any, b: any): boolean {
|
|
|
15
15
|
const arrB = isArray(b)
|
|
16
16
|
let i
|
|
17
17
|
let length
|
|
18
|
-
let key
|
|
18
|
+
let key: string
|
|
19
19
|
|
|
20
20
|
if (arrA && arrB) {
|
|
21
21
|
length = a.length
|
|
@@ -44,8 +44,8 @@ export function _deepEquals(a: any, b: any): boolean {
|
|
|
44
44
|
for (i = length; i-- !== 0; ) if (!hasProp.call(b, keys[i]!)) return false
|
|
45
45
|
|
|
46
46
|
for (i = length; i-- !== 0; ) {
|
|
47
|
-
key = keys[i]
|
|
48
|
-
if (!_deepEquals(a[key
|
|
47
|
+
key = keys[i]!
|
|
48
|
+
if (!_deepEquals(a[key], b[key])) return false
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return true
|
|
@@ -123,10 +123,13 @@ export function _mapValues<T extends AnyObject, OUT = T>(
|
|
|
123
123
|
mapper: ObjectMapper<T, any>,
|
|
124
124
|
mutate = false,
|
|
125
125
|
): OUT {
|
|
126
|
-
return Object.entries(obj).reduce(
|
|
127
|
-
map[k
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
return Object.entries(obj).reduce(
|
|
127
|
+
(map, [k, v]) => {
|
|
128
|
+
map[k as keyof OUT] = mapper(k, v, obj)
|
|
129
|
+
return map
|
|
130
|
+
},
|
|
131
|
+
(mutate ? obj : {}) as OUT,
|
|
132
|
+
)
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
/**
|
|
@@ -165,13 +168,16 @@ export function _mapObject<IN extends AnyObject, OUT>(
|
|
|
165
168
|
obj: IN,
|
|
166
169
|
mapper: ObjectMapper<IN, [key: string, value: any]>,
|
|
167
170
|
): { [P in keyof IN]: OUT } {
|
|
168
|
-
return Object.entries(obj).reduce(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
return Object.entries(obj).reduce(
|
|
172
|
+
(map, [k, v]) => {
|
|
173
|
+
const r = mapper(k, v, obj) || []
|
|
174
|
+
if (r[0]) {
|
|
175
|
+
;(map[r[0]] as any) = r[1]
|
|
176
|
+
}
|
|
177
|
+
return map
|
|
178
|
+
},
|
|
179
|
+
{} as { [P in keyof IN]: OUT },
|
|
180
|
+
)
|
|
175
181
|
}
|
|
176
182
|
|
|
177
183
|
export function _findKeyByValue<T extends AnyObject>(obj: T, v: ValueOf<T>): keyof T | undefined {
|
package/src/promise/pMap.ts
CHANGED
package/src/seq/seq.ts
CHANGED
|
@@ -15,7 +15,10 @@ import { END, SKIP } from '../types'
|
|
|
15
15
|
* @experimental
|
|
16
16
|
*/
|
|
17
17
|
export class Sequence<T> implements Iterable<T> {
|
|
18
|
-
private constructor(
|
|
18
|
+
private constructor(
|
|
19
|
+
initialValue: T | typeof END,
|
|
20
|
+
private nextFn: AbortableMapper<T, T>,
|
|
21
|
+
) {
|
|
19
22
|
this.currentValue = initialValue
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -165,7 +168,10 @@ export function _seq<T>(initialValue: T | typeof END, nextFn: AbortableMapper<T,
|
|
|
165
168
|
* @experimental
|
|
166
169
|
*/
|
|
167
170
|
export class AsyncSequence<T> implements AsyncIterable<T> {
|
|
168
|
-
private constructor(
|
|
171
|
+
private constructor(
|
|
172
|
+
initialValue: T | typeof END,
|
|
173
|
+
private nextFn: AbortableAsyncMapper<T, T>,
|
|
174
|
+
) {
|
|
169
175
|
this.currentValue = initialValue
|
|
170
176
|
}
|
|
171
177
|
|
|
@@ -41,7 +41,7 @@ export interface ReadingTimeResult extends ReadingTimeStats {
|
|
|
41
41
|
|
|
42
42
|
type WordBoundFunction = (char: string) => boolean
|
|
43
43
|
|
|
44
|
-
function codeIsInRanges(num: number, arrayOfRanges: number[][]) {
|
|
44
|
+
function codeIsInRanges(num: number, arrayOfRanges: number[][]): boolean {
|
|
45
45
|
return arrayOfRanges.some(([lowerBound, upperBound]) => lowerBound! <= num && num <= upperBound!)
|
|
46
46
|
}
|
|
47
47
|
|
package/src/zod/zod.util.ts
CHANGED
|
@@ -44,7 +44,11 @@ export function zSafeValidate<T>(
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export class ZodValidationError<T> extends ZodError<T> {
|
|
47
|
-
constructor(
|
|
47
|
+
constructor(
|
|
48
|
+
issues: ZodIssue[],
|
|
49
|
+
public value: T,
|
|
50
|
+
public schema: ZodSchema<T>,
|
|
51
|
+
) {
|
|
48
52
|
super(issues)
|
|
49
53
|
}
|
|
50
54
|
|