@bunt/util
Advanced tools
Comparing version 0.21.5 to 0.21.6
@@ -9,4 +9,4 @@ declare type DeferOnFulfilled<T, TResult1> = ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null; | ||
resolve: (value: T | PromiseLike<T>) => void; | ||
reject: (error: Error) => void; | ||
reject: (error: unknown) => void; | ||
} | ||
export {}; |
@@ -31,7 +31,7 @@ "use strict"; | ||
}; | ||
__classPrivateFieldGet(this, _Defer_event, "f").on("resolve", () => __classPrivateFieldSet(this, _Defer_settled, true, "f")); | ||
__classPrivateFieldGet(this, _Defer_event, "f").on("reject", () => __classPrivateFieldSet(this, _Defer_settled, true, "f")); | ||
__classPrivateFieldGet(this, _Defer_event, "f").once("resolve", () => __classPrivateFieldSet(this, _Defer_settled, true, "f")); | ||
__classPrivateFieldGet(this, _Defer_event, "f").once("reject", () => __classPrivateFieldSet(this, _Defer_settled, true, "f")); | ||
__classPrivateFieldSet(this, _Defer_pending, new Promise((resolve, reject) => { | ||
__classPrivateFieldGet(this, _Defer_event, "f").on("resolve", resolve); | ||
__classPrivateFieldGet(this, _Defer_event, "f").on("reject", reject); | ||
__classPrivateFieldGet(this, _Defer_event, "f").once("resolve", resolve); | ||
__classPrivateFieldGet(this, _Defer_event, "f").once("reject", reject); | ||
}), "f"); | ||
@@ -38,0 +38,0 @@ } |
@@ -17,1 +17,3 @@ import { Ctor, Newable } from "./interfaces"; | ||
export declare const isInstanceOf: <C extends Ctor<any, any[]> | Newable<any>>(value: unknown, type: C) => value is IIS<C>; | ||
export declare function isRejected<T>(item: PromiseSettledResult<T>): item is PromiseRejectedResult; | ||
export declare function isFulfilled<T>(item: PromiseSettledResult<T>): item is PromiseFulfilledResult<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isInstanceOf = exports.isError = exports.isObject = exports.isClass = exports.isArrowFunction = exports.isFunction = exports.isNumber = exports.isArray = exports.isString = exports.isBoolean = exports.isDefined = exports.isVoid = exports.isUndefined = exports.isNull = void 0; | ||
exports.isFulfilled = exports.isRejected = exports.isInstanceOf = exports.isError = exports.isObject = exports.isClass = exports.isArrowFunction = exports.isFunction = exports.isNumber = exports.isArray = exports.isString = exports.isBoolean = exports.isDefined = exports.isVoid = exports.isUndefined = exports.isNull = void 0; | ||
const isNull = (value) => value === null; | ||
@@ -46,2 +46,10 @@ exports.isNull = isNull; | ||
exports.isInstanceOf = isInstanceOf; | ||
function isRejected(item) { | ||
return item.status === "rejected"; | ||
} | ||
exports.isRejected = isRejected; | ||
function isFulfilled(item) { | ||
return item.status === "fulfilled"; | ||
} | ||
exports.isFulfilled = isFulfilled; | ||
//# sourceMappingURL=is.js.map |
@@ -7,3 +7,4 @@ export declare class SingleRef<T> { | ||
ensure(): T; | ||
once(fn: () => T): T; | ||
create(fn: () => T): T; | ||
} |
@@ -34,2 +34,6 @@ "use strict"; | ||
} | ||
once(fn) { | ||
(0, assert_1.assert)(!this.has(), "Cannot getting twice"); | ||
return this.create(fn); | ||
} | ||
create(fn) { | ||
@@ -36,0 +40,0 @@ const value = store.get(__classPrivateFieldGet(this, _SingleRef_ref, "f")) ?? fn(); |
{ | ||
"name": "@bunt/util", | ||
"version": "0.21.5", | ||
"version": "0.21.6", | ||
"keywords": [ | ||
@@ -29,3 +29,3 @@ "typescript" | ||
"license": "MIT", | ||
"gitHead": "c7266115704a1ffeba8058a047dbdaa65f365131" | ||
"gitHead": "dfb8b992306230396f0f83c77f50fc56610592f3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141291
2156
173