@naturalcycles/js-lib 14.179.0 → 14.180.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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/polyfill.d.ts +1 -0
- package/dist/polyfill.js +10 -0
- package/dist/time/time.util.d.ts +10 -0
- package/dist/time/time.util.js +19 -1
- package/dist-esm/index.js +1 -0
- package/dist-esm/polyfill.js +7 -0
- package/dist-esm/time/time.util.js +17 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/polyfill.ts +6 -0
- package/src/time/time.util.ts +18 -0
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export * from './env/buildInfo';
|
|
|
80
80
|
export * from './form.util';
|
|
81
81
|
export * from './semver';
|
|
82
82
|
export * from './web';
|
|
83
|
+
export * from './polyfill';
|
|
83
84
|
export * from './zod/zod.util';
|
|
84
85
|
export * from './zod/zod.shared.schemas';
|
|
85
86
|
import { z, ZodSchema, ZodError, ZodIssue } from 'zod';
|
package/dist/index.js
CHANGED
|
@@ -84,6 +84,7 @@ tslib_1.__exportStar(require("./env/buildInfo"), exports);
|
|
|
84
84
|
tslib_1.__exportStar(require("./form.util"), exports);
|
|
85
85
|
tslib_1.__exportStar(require("./semver"), exports);
|
|
86
86
|
tslib_1.__exportStar(require("./web"), exports);
|
|
87
|
+
tslib_1.__exportStar(require("./polyfill"), exports);
|
|
87
88
|
tslib_1.__exportStar(require("./zod/zod.util"), exports);
|
|
88
89
|
tslib_1.__exportStar(require("./zod/zod.shared.schemas"), exports);
|
|
89
90
|
const zod_1 = require("zod");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function polyfillDispose(): void;
|
package/dist/polyfill.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.polyfillDispose = void 0;
|
|
4
|
+
function polyfillDispose() {
|
|
5
|
+
// @ts-expect-error polyfill
|
|
6
|
+
Symbol.dispose ??= Symbol('Symbol.dispose');
|
|
7
|
+
// @ts-expect-error polyfill
|
|
8
|
+
Symbol.asyncDispose ??= Symbol('Symbol.asyncDispose');
|
|
9
|
+
}
|
|
10
|
+
exports.polyfillDispose = polyfillDispose;
|
package/dist/time/time.util.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* using _ = blockTimer()
|
|
3
|
+
* // will log "took 1.234 sec" on dispose
|
|
4
|
+
*
|
|
5
|
+
* using _ = blockTimer('named')
|
|
6
|
+
* // will log "named took 1.234 sec" on dispose
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export declare function _blockTimer(name?: string): Disposable;
|
|
1
11
|
/**
|
|
2
12
|
* Returns time passed since `from` until `until` (default to Date.now())
|
|
3
13
|
*/
|
package/dist/time/time.util.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._ms = exports._since = void 0;
|
|
3
|
+
exports._ms = exports._since = exports._blockTimer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* using _ = blockTimer()
|
|
6
|
+
* // will log "took 1.234 sec" on dispose
|
|
7
|
+
*
|
|
8
|
+
* using _ = blockTimer('named')
|
|
9
|
+
* // will log "named took 1.234 sec" on dispose
|
|
10
|
+
*
|
|
11
|
+
* @experimental
|
|
12
|
+
*/
|
|
13
|
+
function _blockTimer(name) {
|
|
14
|
+
const started = Date.now();
|
|
15
|
+
return {
|
|
16
|
+
[Symbol.dispose]() {
|
|
17
|
+
console.log(`${name ? name + ' ' : ''}took ${_since(started)}`);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports._blockTimer = _blockTimer;
|
|
4
22
|
/**
|
|
5
23
|
* Returns time passed since `from` until `until` (default to Date.now())
|
|
6
24
|
*/
|
package/dist-esm/index.js
CHANGED
|
@@ -80,6 +80,7 @@ export * from './env/buildInfo';
|
|
|
80
80
|
export * from './form.util';
|
|
81
81
|
export * from './semver';
|
|
82
82
|
export * from './web';
|
|
83
|
+
export * from './polyfill';
|
|
83
84
|
export * from './zod/zod.util';
|
|
84
85
|
export * from './zod/zod.shared.schemas';
|
|
85
86
|
import { z, ZodSchema, ZodError } from 'zod';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function polyfillDispose() {
|
|
2
|
+
var _a, _b;
|
|
3
|
+
// @ts-expect-error polyfill
|
|
4
|
+
(_a = Symbol.dispose) !== null && _a !== void 0 ? _a : (Symbol.dispose = Symbol('Symbol.dispose'));
|
|
5
|
+
// @ts-expect-error polyfill
|
|
6
|
+
(_b = Symbol.asyncDispose) !== null && _b !== void 0 ? _b : (Symbol.asyncDispose = Symbol('Symbol.asyncDispose'));
|
|
7
|
+
}
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* using _ = blockTimer()
|
|
3
|
+
* // will log "took 1.234 sec" on dispose
|
|
4
|
+
*
|
|
5
|
+
* using _ = blockTimer('named')
|
|
6
|
+
* // will log "named took 1.234 sec" on dispose
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export function _blockTimer(name) {
|
|
11
|
+
const started = Date.now();
|
|
12
|
+
return {
|
|
13
|
+
[Symbol.dispose]() {
|
|
14
|
+
console.log(`${name ? name + ' ' : ''}took ${_since(started)}`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
1
18
|
/**
|
|
2
19
|
* Returns time passed since `from` until `until` (default to Date.now())
|
|
3
20
|
*/
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -80,6 +80,7 @@ export * from './env/buildInfo'
|
|
|
80
80
|
export * from './form.util'
|
|
81
81
|
export * from './semver'
|
|
82
82
|
export * from './web'
|
|
83
|
+
export * from './polyfill'
|
|
83
84
|
export * from './zod/zod.util'
|
|
84
85
|
export * from './zod/zod.shared.schemas'
|
|
85
86
|
import { z, ZodSchema, ZodError, ZodIssue } from 'zod'
|
package/src/polyfill.ts
ADDED
package/src/time/time.util.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* using _ = blockTimer()
|
|
3
|
+
* // will log "took 1.234 sec" on dispose
|
|
4
|
+
*
|
|
5
|
+
* using _ = blockTimer('named')
|
|
6
|
+
* // will log "named took 1.234 sec" on dispose
|
|
7
|
+
*
|
|
8
|
+
* @experimental
|
|
9
|
+
*/
|
|
10
|
+
export function _blockTimer(name?: string): Disposable {
|
|
11
|
+
const started = Date.now()
|
|
12
|
+
return {
|
|
13
|
+
[Symbol.dispose](): void {
|
|
14
|
+
console.log(`${name ? name + ' ' : ''}took ${_since(started)}`)
|
|
15
|
+
},
|
|
16
|
+
} as any
|
|
17
|
+
}
|
|
18
|
+
|
|
1
19
|
/**
|
|
2
20
|
* Returns time passed since `from` until `until` (default to Date.now())
|
|
3
21
|
*/
|