@reldens/utils 0.17.2 → 0.17.3
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 +21 -0
- 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,24 @@ 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
|
+
|
|
147
168
|
serializeFormData(formData)
|
|
148
169
|
{
|
|
149
170
|
if(0 === formData.length){
|