UNPKG

lib-utils-ts

Version:

<img src="https://img.shields.io/npm/v/lib-utils-ts"/> <img src="https://img.shields.io/snyk/vulnerabilities/npm/lib-utils-ts"/> <img src="https://img.shields.io/npm/l/lib-utils-ts"/> <img src="https://img.shields.io/github/languages/top/devGnode/lib-util

20 lines 587 B
import {supplier, supplierFn} from "../Interface"; /** * @Supplier */ export abstract class Supplier<T> implements supplier<T>{ /**@override*/ get: supplierFn<T> = ()=> void 0; /*** * @adapt * @params supplierA * @returns Supplier<T> */ public static adapt<T>(supplierA:Supplier<T>|Function):Supplier<T>{ if(supplierA instanceof Supplier )return supplierA; return new class extends Supplier<T> { get:supplierFn<T> = ():T=> typeof supplierA === "function" ? <T>supplierA() : null; }; } } Object.package(this);