@naturalcycles/js-lib 14.154.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.
@@ -13,7 +13,7 @@ var ISODayOfWeek;
13
13
  ISODayOfWeek[ISODayOfWeek["FRIDAY"] = 5] = "FRIDAY";
14
14
  ISODayOfWeek[ISODayOfWeek["SATURDAY"] = 6] = "SATURDAY";
15
15
  ISODayOfWeek[ISODayOfWeek["SUNDAY"] = 7] = "SUNDAY";
16
- })(ISODayOfWeek = exports.ISODayOfWeek || (exports.ISODayOfWeek = {}));
16
+ })(ISODayOfWeek || (exports.ISODayOfWeek = ISODayOfWeek = {}));
17
17
  const weekStartsOn = 1; // mon, as per ISO
18
18
  const MILLISECONDS_IN_WEEK = 604800000;
19
19
  const SECONDS_IN_DAY = 86400;
@@ -0,0 +1,36 @@
1
+ import type { UnixTimestampNumber } from '../types';
2
+ export interface BuildInfo {
3
+ /**
4
+ * Unix timestamp of when the build was made.
5
+ */
6
+ ts: UnixTimestampNumber;
7
+ /**
8
+ * Unix timestamp of commit ("committer date", not "author date")
9
+ */
10
+ tsCommit: UnixTimestampNumber;
11
+ repoName: string;
12
+ branchName: string;
13
+ /**
14
+ * GIT sha revision (first 7 characters)
15
+ */
16
+ rev: string;
17
+ /**
18
+ * "Version string" in the following format:
19
+ * yyyyMMdd_HHmm_$repoName_$branch_$rev
20
+ *
21
+ * E.g:
22
+ * 20190419_1728_myrepo_master_21aecf5
23
+ */
24
+ ver: string;
25
+ /**
26
+ * Build during development.
27
+ */
28
+ dev?: boolean;
29
+ /**
30
+ * Build "environment".
31
+ * Normally taken from process.env.APP_ENV
32
+ * Can be undefined.
33
+ */
34
+ env?: string;
35
+ }
36
+ export declare function generateBuildInfoDev(): BuildInfo;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateBuildInfoDev = void 0;
4
+ const localTime_1 = require("../datetime/localTime");
5
+ function generateBuildInfoDev() {
6
+ const now = (0, localTime_1.localTime)();
7
+ const ts = now.unix();
8
+ const rev = 'devRev';
9
+ const branchName = 'devBranch';
10
+ const repoName = 'devRepo';
11
+ const tsCommit = now.unix();
12
+ const ver = [now.toStringCompact(), repoName, branchName, rev].join('_');
13
+ return {
14
+ ts,
15
+ tsCommit,
16
+ repoName,
17
+ branchName,
18
+ rev,
19
+ ver,
20
+ env: 'dev',
21
+ };
22
+ }
23
+ exports.generateBuildInfoDev = generateBuildInfoDev;
@@ -20,4 +20,4 @@ var ErrorMode;
20
20
  * Completely suppress errors, do not aggregate nor throw anything. Resilient mode.
21
21
  */
22
22
  ErrorMode["SUPPRESS"] = "SUPPRESS";
23
- })(ErrorMode = exports.ErrorMode || (exports.ErrorMode = {}));
23
+ })(ErrorMode || (exports.ErrorMode = ErrorMode = {}));
package/dist/index.d.ts CHANGED
@@ -79,6 +79,7 @@ export * from './http/http.model';
79
79
  export * from './http/fetcher';
80
80
  export * from './http/fetcher.model';
81
81
  export * from './string/hash.util';
82
+ export * from './env/buildInfo';
82
83
  export * from './zod/zod.util';
83
84
  export * from './zod/zod.shared.schemas';
84
85
  import { z, ZodSchema, ZodError, ZodIssue } from 'zod';
package/dist/index.js CHANGED
@@ -83,6 +83,7 @@ tslib_1.__exportStar(require("./http/http.model"), exports);
83
83
  tslib_1.__exportStar(require("./http/fetcher"), exports);
84
84
  tslib_1.__exportStar(require("./http/fetcher.model"), exports);
85
85
  tslib_1.__exportStar(require("./string/hash.util"), exports);
86
+ tslib_1.__exportStar(require("./env/buildInfo"), exports);
86
87
  tslib_1.__exportStar(require("./zod/zod.util"), exports);
87
88
  tslib_1.__exportStar(require("./zod/zod.shared.schemas"), exports);
88
89
  const zod_1 = require("zod");
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) => Object.defineProperty(obj, propertyName, { value, enumerable: true, writable: true });
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,
package/dist/vendor/is.js CHANGED
@@ -334,7 +334,7 @@ var AssertionTypeDescription;
334
334
  AssertionTypeDescription["inRange"] = "in range";
335
335
  AssertionTypeDescription["any"] = "predicate returns truthy for any value";
336
336
  AssertionTypeDescription["all"] = "predicate returns truthy for all values";
337
- })(AssertionTypeDescription = exports.AssertionTypeDescription || (exports.AssertionTypeDescription = {}));
337
+ })(AssertionTypeDescription || (exports.AssertionTypeDescription = AssertionTypeDescription = {}));
338
338
  exports.assert = {
339
339
  // Unknowns.
340
340
  undefined: (value) => assertType(is.undefined(value), 'undefined', value),
@@ -0,0 +1,19 @@
1
+ import { localTime } from '../datetime/localTime';
2
+ export function generateBuildInfoDev() {
3
+ const now = localTime();
4
+ const ts = now.unix();
5
+ const rev = 'devRev';
6
+ const branchName = 'devBranch';
7
+ const repoName = 'devRepo';
8
+ const tsCommit = now.unix();
9
+ const ver = [now.toStringCompact(), repoName, branchName, rev].join('_');
10
+ return {
11
+ ts,
12
+ tsCommit,
13
+ repoName,
14
+ branchName,
15
+ rev,
16
+ ver,
17
+ env: 'dev',
18
+ };
19
+ }
package/dist-esm/index.js CHANGED
@@ -79,6 +79,7 @@ export * from './http/http.model';
79
79
  export * from './http/fetcher';
80
80
  export * from './http/fetcher.model';
81
81
  export * from './string/hash.util';
82
+ export * from './env/buildInfo';
82
83
  export * from './zod/zod.util';
83
84
  export * from './zod/zod.shared.schemas';
84
85
  import { z, ZodSchema, ZodError } from 'zod';
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) => Object.defineProperty(obj, propertyName, { value, enumerable: true, writable: true });
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.154.0",
3
+ "version": "14.155.1",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
@@ -20,11 +20,14 @@
20
20
  "@types/node": "^20.1.0",
21
21
  "crypto-js": "^4.1.1",
22
22
  "jest": "^29.0.0",
23
- "prettier": "^2.1.2",
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"
27
27
  },
28
+ "resolutions": {
29
+ "expect-type": "0.15.0"
30
+ },
28
31
  "files": [
29
32
  "dist",
30
33
  "dist-esm",
@@ -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((map, item, index) => {
101
- const res = mapper(item, index)
102
- if (res !== undefined) {
103
- map[res] = [...(map[res] || []), item]
104
- }
105
- return map
106
- }, {} as StringMap<T[]>)
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(public start: LocalDate, public end: LocalDate) {}
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(private $year: number, private $month: number, private $day: number) {}
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(private $start: UnixTimestampNumber, private $end: UnixTimestampNumber) {}
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
 
@@ -0,0 +1,64 @@
1
+ import { localTime } from '../datetime/localTime'
2
+ import type { UnixTimestampNumber } from '../types'
3
+
4
+ export interface BuildInfo {
5
+ /**
6
+ * Unix timestamp of when the build was made.
7
+ */
8
+ ts: UnixTimestampNumber
9
+
10
+ /**
11
+ * Unix timestamp of commit ("committer date", not "author date")
12
+ */
13
+ tsCommit: UnixTimestampNumber
14
+
15
+ repoName: string
16
+ branchName: string
17
+
18
+ /**
19
+ * GIT sha revision (first 7 characters)
20
+ */
21
+ rev: string
22
+
23
+ /**
24
+ * "Version string" in the following format:
25
+ * yyyyMMdd_HHmm_$repoName_$branch_$rev
26
+ *
27
+ * E.g:
28
+ * 20190419_1728_myrepo_master_21aecf5
29
+ */
30
+ ver: string
31
+
32
+ /**
33
+ * Build during development.
34
+ */
35
+ dev?: boolean
36
+
37
+ /**
38
+ * Build "environment".
39
+ * Normally taken from process.env.APP_ENV
40
+ * Can be undefined.
41
+ */
42
+ env?: string
43
+ }
44
+
45
+ export function generateBuildInfoDev(): BuildInfo {
46
+ const now = localTime()
47
+ const ts = now.unix()
48
+ const rev = 'devRev'
49
+ const branchName = 'devBranch'
50
+ const repoName = 'devRepo'
51
+ const tsCommit = now.unix()
52
+
53
+ const ver = [now.toStringCompact(), repoName, branchName, rev].join('_')
54
+
55
+ return {
56
+ ts,
57
+ tsCommit,
58
+ repoName,
59
+ branchName,
60
+ rev,
61
+ ver,
62
+ env: 'dev',
63
+ }
64
+ }
package/src/index.ts CHANGED
@@ -79,6 +79,7 @@ export * from './http/http.model'
79
79
  export * from './http/fetcher'
80
80
  export * from './http/fetcher.model'
81
81
  export * from './string/hash.util'
82
+ export * from './env/buildInfo'
82
83
  export * from './zod/zod.util'
83
84
  export * from './zod/zod.shared.schemas'
84
85
  import { z, ZodSchema, ZodError, ZodIssue } from 'zod'
@@ -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(public readonly size: number, public readonly data: number[] = []) {}
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
@@ -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!], b[key!])) return false
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((map, [k, v]) => {
127
- map[k as keyof OUT] = mapper(k, v, obj)
128
- return map
129
- }, (mutate ? obj : {}) as OUT)
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((map, [k, v]) => {
169
- const r = mapper(k, v, obj) || []
170
- if (r[0]) {
171
- ;(map[r[0]] as any) = r[1]
172
- }
173
- return map
174
- }, {} as { [P in keyof IN]: OUT })
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 {
@@ -121,7 +121,7 @@ export async function pMap<IN, OUT>(
121
121
  }
122
122
 
123
123
  return await new Promise<OUT[]>((resolve, reject) => {
124
- const next = () => {
124
+ const next = (): void => {
125
125
  if (isSettled) {
126
126
  return
127
127
  }
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(initialValue: T | typeof END, private nextFn: AbortableMapper<T, T>) {
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(initialValue: T | typeof END, private nextFn: AbortableAsyncMapper<T, T>) {
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
 
@@ -44,7 +44,11 @@ export function zSafeValidate<T>(
44
44
  }
45
45
 
46
46
  export class ZodValidationError<T> extends ZodError<T> {
47
- constructor(issues: ZodIssue[], public value: T, public schema: ZodSchema<T>) {
47
+ constructor(
48
+ issues: ZodIssue[],
49
+ public value: T,
50
+ public schema: ZodSchema<T>,
51
+ ) {
48
52
  super(issues)
49
53
  }
50
54