@pushrocks/lik
Advanced tools
Comparing version 4.0.16 to 4.0.17
@@ -22,3 +22,3 @@ import * as plugins from './lik.plugins'; | ||
*/ | ||
addInterest(objectArg: DTInterestId): Promise<Interest<DTInterestId, DTInterestFullfillment>>; | ||
addInterest(objectArg: DTInterestId, defaultFullfillmentArg?: DTInterestFullfillment): Promise<Interest<DTInterestId, DTInterestFullfillment>>; | ||
interestObservable: plugins.smartrx.ObservableIntake<Interest<DTInterestId, any>>; | ||
@@ -25,0 +25,0 @@ /** |
import * as plugins from './lik.plugins'; | ||
import { InterestMap, IInterestComparisonFunc } from './lik.interestmap'; | ||
export interface IInterestOptions { | ||
export interface IInterestOptions<DTInterestFullfillment> { | ||
markLostAfterDefault: number; | ||
defaultFullfillment?: DTInterestFullfillment; | ||
} | ||
export declare class Interest<DTInterestId, DTInterestFullfillment> { | ||
options: IInterestOptions; | ||
options: IInterestOptions<DTInterestFullfillment>; | ||
private interestMapRef; | ||
@@ -30,3 +31,3 @@ originalInterest: DTInterestId; | ||
*/ | ||
constructor(interestMapArg: InterestMap<DTInterestId, DTInterestFullfillment>, interestArg: DTInterestId, comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg?: IInterestOptions); | ||
constructor(interestMapArg: InterestMap<DTInterestId, DTInterestFullfillment>, interestArg: DTInterestId, comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, optionsArg?: IInterestOptions<DTInterestFullfillment>); | ||
/** | ||
@@ -33,0 +34,0 @@ * self destructs the interest |
@@ -71,2 +71,5 @@ "use strict"; | ||
this.interestMapRef.removeInterest(this); | ||
if (!this.isFullfilled && this.options.defaultFullfillment) { | ||
this.fullfillInterest(this.options.defaultFullfillment); | ||
} | ||
} | ||
@@ -87,2 +90,2 @@ /** | ||
exports.Interest = Interest; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLmludGVyZXN0bWFwLmludGVyZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvd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ENBQUM7SUF6Q0Q7O09BRUc7SUFDSCxJQUFXLGdCQUFnQjtRQUN6QixPQUFPLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDcEQsQ0FBQztJQU9EOztPQUVHO0lBQ0ksZ0JBQWdCLENBQUMsU0FBaUM7UUFDdkQsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7UUFDekIsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEVBQUUsQ0FBQztRQUM1QixJQUFJLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQzNDLENBQUM7SUF3QkQsa0NBQWtDO0lBQ2xDLHVCQUF1QjtJQUN2QixrQ0FBa0M7SUFFbEM7O09BRUc7SUFDSSxPQUFPO1FBQ1osSUFBSSxDQUFDLGNBQWMsQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDekMsSUFBSSxDQUFDLElBQUksQ0FBQyxZQUFZLElBQUksSUFBSSxDQUFDLE9BQU8sQ0FBQyxtQkFBbUIsRUFBRTtZQUMxRCxJQUFJLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDO1NBQ3pEO0lBQ0gsQ0FBQztJQUVEOztPQUVHO0lBQ0ksUUFBUTtRQUNiLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUNoQyxDQUFDO0lBRUQ7O09BRUc7SUFDSSxLQUFLO1FBQ1YsSUFBSSxDQUFDLGdCQUFnQixDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ2hDLENBQUM7Q0FDRjtBQXBGRCw0QkFvRkMifQ== |
@@ -41,7 +41,8 @@ "use strict"; | ||
*/ | ||
async addInterest(objectArg) { | ||
async addInterest(objectArg, defaultFullfillmentArg) { | ||
const comparisonString = this.comparisonFunc(objectArg); | ||
let returnInterest; | ||
const newInterest = new lik_interestmap_interest_1.Interest(this, objectArg, this.comparisonFunc, { | ||
markLostAfterDefault: this.options.markLostAfterDefault | ||
markLostAfterDefault: this.options.markLostAfterDefault, | ||
defaultFullfillment: defaultFullfillmentArg | ||
}); | ||
@@ -118,2 +119,2 @@ let interestExists = false; | ||
exports.InterestMap = InterestMap; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLmludGVyZXN0bWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbGlrLmludGVyZXN0bWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSx1REFBeUM7QUFDekMsbURBQTRDO0FBSTVDLHlFQUFzRDtBQVF0RCxNQUFhLFdBQVc7SUFhdEIsWUFBWSxpQkFBd0QsRUFBRSxhQUFrQyxFQUFFO1FBVjFHOztXQUVHO1FBQ0ssc0JBQWlCLEdBQUcsSUFBSSx5QkFBUyxFQUFrRCxDQUFDO1FBOEM1RiwyQ0FBMkM7UUFDcEMsdUJBQWtCLEdBQUcsSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLGdCQUFnQixFQUErQixDQUFDO1FBdkM5RixJQUFJLENBQUMsY0FBYyxHQUFHLGlCQUFpQixDQUFDO1FBQ3hDLElBQUksQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDO0lBQzVCLENBQUM7SUFFRDs7O09BR0c7SUFDSSxLQUFLLENBQUMsV0FBVyxDQUN0QixTQUF1QjtRQUV2QixNQUFNLGdCQUFnQixHQUFHLElBQUksQ0FBQyxjQUFjLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDeEQsSUFBSSxjQUE4RCxDQUFDO1FBQ25FLE1BQU0sV0FBVyxHQUFHLElBQUksbUNBQVEsQ0FDOUIsSUFBSSxFQUNKLFNBQVMsRUFD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Q0FBQyxDQUFDLFdBQVcsRUFBRSxFQUFFO1lBQzNELE9BQU8sV0FBVyxDQUFDLGdCQUFnQixLQUFLLGdCQUFnQixDQUFDO1FBQzNELENBQUMsQ0FBQyxDQUFDO1FBQ0gsT0FBTyxRQUFRLENBQUMsQ0FBQyxnRkFBZ0Y7SUFDbkcsQ0FBQztDQUNGO0FBaEhELGtDQWdIQyJ9 |
{ | ||
"name": "@pushrocks/lik", | ||
"version": "4.0.16", | ||
"version": "4.0.17", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "light little helpers for node", |
@@ -5,8 +5,9 @@ import * as plugins from './lik.plugins'; | ||
export interface IInterestOptions { | ||
export interface IInterestOptions<DTInterestFullfillment> { | ||
markLostAfterDefault: number; | ||
defaultFullfillment?: DTInterestFullfillment; | ||
} | ||
export class Interest<DTInterestId, DTInterestFullfillment> { | ||
public options: IInterestOptions; | ||
public options: IInterestOptions<DTInterestFullfillment>; | ||
@@ -52,3 +53,3 @@ private interestMapRef: InterestMap<DTInterestId, DTInterestFullfillment>; | ||
comparisonFuncArg: IInterestComparisonFunc<DTInterestId>, | ||
optionsArg?: IInterestOptions | ||
optionsArg?: IInterestOptions<DTInterestFullfillment> | ||
) { | ||
@@ -77,2 +78,5 @@ this.interestMapRef = interestMapArg; | ||
this.interestMapRef.removeInterest(this); | ||
if (!this.isFullfilled && this.options.defaultFullfillment) { | ||
this.fullfillInterest(this.options.defaultFullfillment); | ||
} | ||
} | ||
@@ -79,0 +83,0 @@ |
@@ -37,3 +37,4 @@ import * as plugins from './lik.plugins'; | ||
public async addInterest( | ||
objectArg: DTInterestId | ||
objectArg: DTInterestId, | ||
defaultFullfillmentArg?: DTInterestFullfillment | ||
): Promise<Interest<DTInterestId, DTInterestFullfillment>> { | ||
@@ -47,3 +48,4 @@ const comparisonString = this.comparisonFunc(objectArg); | ||
{ | ||
markLostAfterDefault: this.options.markLostAfterDefault | ||
markLostAfterDefault: this.options.markLostAfterDefault, | ||
defaultFullfillment: defaultFullfillmentArg | ||
} | ||
@@ -50,0 +52,0 @@ ); |
Sorry, the diff of this file is too big to display
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
1559971
14026