@reldens/utils 0.17.2 → 0.17.4

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 +40 -0
  2. package/package.json +1 -1
package/lib/shortcuts.js CHANGED
@@ -133,6 +133,9 @@ class Shortcuts
133
133
 
134
134
  fetchByProperty(itemsArray, propertyName, propertyValue)
135
135
  {
136
+ if(!this.isArray(itemsArray)){
137
+ return false;
138
+ }
136
139
  if(0 === itemsArray.length){
137
140
  return false;
138
141
  }
@@ -144,6 +147,43 @@ class Shortcuts
144
147
  return false;
145
148
  }
146
149
 
150
+ fetchByPropertyOnObject(objectList, propertyName, propertyValue)
151
+ {
152
+ if(!objectList){
153
+ return false;
154
+ }
155
+ let objKeys = Object.keys(objectList);
156
+ if(0 === objKeys.length){
157
+ return false;
158
+ }
159
+ for(let i of objKeys){
160
+ let obj = objectList[i];
161
+ if(obj[propertyName] === propertyValue){
162
+ return obj;
163
+ }
164
+ }
165
+ return false;
166
+ }
167
+
168
+ fetchAllByPropertyOnObject(objectList, propertyName, propertyValue)
169
+ {
170
+ if(!objectList){
171
+ return false;
172
+ }
173
+ let objKeys = Object.keys(objectList);
174
+ if(0 === objKeys.length){
175
+ return false;
176
+ }
177
+ let results = [];
178
+ for(let i of objKeys){
179
+ let obj = objectList[i];
180
+ if(obj[propertyName] === propertyValue){
181
+ results.push(obj);
182
+ }
183
+ }
184
+ return results;
185
+ }
186
+
147
187
  serializeFormData(formData)
148
188
  {
149
189
  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.2",
4
+ "version": "0.17.4",
5
5
  "description": "Reldens - Utils",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",