isSyncDisposable
function isSyncDisposable(value): value is Disposable;Defined in: is-disposable.ts:37
Check if a value has a Symbol.dispose method (sync disposable), i.e.
whether it can be bound with using.
Only objects pass: a function carrying the symbol returns false.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
unknown |
Returns
Section titled “Returns”value is Disposable
Example
Section titled “Example”import { defer, deferSync, isSyncDisposable } from "@xtandard/lib";
isSyncDisposable(deferSync(() => {})); // trueisSyncDisposable(defer(() => {})); // false (async only)isSyncDisposable({ [Symbol.dispose]() {} }); // true