@anandamideio/entity
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -97,2 +97,10 @@ /** | ||
/** | ||
* find implementation for the entity map. | ||
* | ||
* @param {Function} callback - The function to call for each entity. | ||
* @param {any} thisArg - The value to use as `this` when executing the callback. | ||
* @returns {EntityType | undefined} | ||
*/ | ||
find(callback: (entity: EntityType, identifier: Identifiers, entityMap: Map<symbol, EntityType>) => boolean, thisArg?: any): EntityType | undefined; | ||
/** | ||
* reduce implementation for the entity map. | ||
@@ -99,0 +107,0 @@ * |
@@ -152,2 +152,18 @@ "use strict"; | ||
/** | ||
* find implementation for the entity map. | ||
* | ||
* @param {Function} callback - The function to call for each entity. | ||
* @param {any} thisArg - The value to use as `this` when executing the callback. | ||
* @returns {EntityType | undefined} | ||
*/ | ||
find(callback, thisArg) { | ||
let result; | ||
this.entitySymbols.forEach((symbol, identifier) => { | ||
if (callback.call(thisArg, this.entityMap.get(symbol), identifier, this.entityMap)) { | ||
result = this.entityMap.get(symbol); | ||
} | ||
}); | ||
return result; | ||
} | ||
/** | ||
* reduce implementation for the entity map. | ||
@@ -154,0 +170,0 @@ * |
{ | ||
"name": "@anandamideio/entity", | ||
"main": "dist/index.js", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json" | ||
}, | ||
"devDependencies": { | ||
@@ -6,0 +9,0 @@ "@eslint/js": "^8.57.0", |
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
12999
324