@reldens/utils 0.17.3 → 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.
Files changed (2) hide show
  1. package/lib/shortcuts.js +36 -0
  2. 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){
@@ -165,6 +182,25 @@ class Shortcuts
165
182
  return false;
166
183
  }
167
184
 
185
+ fetchAllByPropertyOnObject(objectList, propertyName, propertyValue)
186
+ {
187
+ if(!objectList){
188
+ return false;
189
+ }
190
+ let objKeys = Object.keys(objectList);
191
+ if(0 === objKeys.length){
192
+ return false;
193
+ }
194
+ let results = [];
195
+ for(let i of objKeys){
196
+ let obj = objectList[i];
197
+ if(obj[propertyName] === propertyValue){
198
+ results.push(obj);
199
+ }
200
+ }
201
+ return results;
202
+ }
203
+
168
204
  serializeFormData(formData)
169
205
  {
170
206
  if(0 === formData.length){
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/utils",
3
3
  "scope": "@reldens",
4
- "version": "0.17.3",
4
+ "version": "0.17.5",
5
5
  "description": "Reldens - Utils",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",