bajo 0.2.27 → 0.2.28

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.
@@ -30,9 +30,9 @@ function formatErrorDetails (value, ns) {
30
30
  const val = get(v, 'context.value')
31
31
  value[i] = {
32
32
  field,
33
- error: print.__(`validation.${v.type}`, v.context, { ns })
33
+ error: print.__(`validation.${v.type}`, v.context, { ns }),
34
+ value: val
34
35
  }
35
- result[field] = val
36
36
  })
37
37
  return result
38
38
  }
@@ -4,6 +4,8 @@ import ms from 'ms'
4
4
  import dayjs from '../lib/dayjs.js'
5
5
  import isSet from './is-set.js'
6
6
 
7
+ const statics = ['*']
8
+
7
9
  function parseDur (val) {
8
10
  return isNumber(val) ? val : ms(val)
9
11
  }
@@ -22,11 +24,17 @@ function parseObject (obj, silent = true, parseValue = false) {
22
24
  else if (isArray(v)) {
23
25
  v.forEach((i, idx) => {
24
26
  if (isPlainObject(i)) obj[k][idx] = parseObject(i)
27
+ else if (statics.includes(i)) obj[k][idx] = i
25
28
  else if (parseValue) obj[k][idx] = dotenvParseVariables(set({}, 'item', obj[k][idx]), { assignToProcessEnv: false }).item
29
+ if (isArray(obj[k][idx])) obj[k][idx] = obj[k][idx].map(item => typeof item === 'string' ? item.trim() : item)
26
30
  })
27
31
  } else if (isSet(v)) {
28
32
  try {
29
- if (parseValue) obj[k] = dotenvParseVariables(set({}, 'item', v), { assignToProcessEnv: false }).item
33
+ if (statics.includes(v)) obj[k] = v
34
+ else if (parseValue) {
35
+ obj[k] = dotenvParseVariables(set({}, 'item', v), { assignToProcessEnv: false }).item
36
+ if (isArray(obj[k])) obj[k] = obj[k].map(item => typeof item === 'string' ? item.trim() : item)
37
+ }
30
38
  if (k.slice(-3) === 'Dur') obj[k] = parseDur(v)
31
39
  if (k.slice(-2) === 'Dt') obj[k] = parseDt(v)
32
40
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "description": "A framework to build a giant monstrous app rapidly",
5
5
  "main": "boot/index.js",
6
6
  "scripts": {