@reldens/utils 0.17.4 → 0.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/shortcuts.js +17 -0
- package/package.json +1 -1
package/lib/shortcuts.js
CHANGED
|
@@ -147,6 +147,23 @@ class Shortcuts
|
|
|
147
147
|
return false;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
fetchAllByProperty(itemsArray, propertyName, propertyValue)
|
|
151
|
+
{
|
|
152
|
+
if(!this.isArray(itemsArray)){
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
if(0 === itemsArray.length){
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
let foundItems = [];
|
|
159
|
+
for(let item of itemsArray){
|
|
160
|
+
if(item[propertyName] === propertyValue){
|
|
161
|
+
foundItems.push(item);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return foundItems;
|
|
165
|
+
}
|
|
166
|
+
|
|
150
167
|
fetchByPropertyOnObject(objectList, propertyName, propertyValue)
|
|
151
168
|
{
|
|
152
169
|
if(!objectList){
|