@questwork/q-utilities 0.1.6 → 0.1.7

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.
@@ -1091,7 +1091,13 @@ class Service {
1091
1091
  return this.repo.init(options)
1092
1092
  }
1093
1093
  initFromArray(arr = []) {
1094
- return arr.map((i) => this.init(i))
1094
+ if (Array.isArray(arr)) {
1095
+ return arr.map((a) => this.init(a))
1096
+ }
1097
+ return []
1098
+ }
1099
+ initOnlyValidFromArray(arr = []) {
1100
+ return this.initFromArray(arr).filter((i) => i)
1095
1101
  }
1096
1102
 
1097
1103
  async saveAll({ docs = [], systemLog } = {}) {
package/dist/index.min.js CHANGED
@@ -1066,7 +1066,13 @@ class Service {
1066
1066
  return this.repo.init(options)
1067
1067
  }
1068
1068
  initFromArray(arr = []) {
1069
- return arr.map((i) => this.init(i))
1069
+ if (Array.isArray(arr)) {
1070
+ return arr.map((a) => this.init(a))
1071
+ }
1072
+ return []
1073
+ }
1074
+ initOnlyValidFromArray(arr = []) {
1075
+ return this.initFromArray(arr).filter((i) => i)
1070
1076
  }
1071
1077
 
1072
1078
  async saveAll({ docs = [], systemLog } = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@questwork/q-utilities",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Questwork QUtilities",
5
5
  "main": "dist/index.min.js",
6
6
  "type": "module",