@domql/utils 3.2.3 → 3.2.10

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 (53) hide show
  1. package/array.js +11 -5
  2. package/cache.js +3 -0
  3. package/component.js +3 -4
  4. package/dist/cjs/array.js +11 -5
  5. package/dist/cjs/component.js +4 -6
  6. package/dist/cjs/element.js +5 -5
  7. package/dist/cjs/extends.js +43 -27
  8. package/dist/cjs/function.js +3 -3
  9. package/dist/cjs/index.js +1 -0
  10. package/dist/cjs/key.js +2 -2
  11. package/dist/cjs/keys.js +30 -16
  12. package/dist/cjs/methods.js +64 -28
  13. package/dist/cjs/object.js +141 -125
  14. package/dist/cjs/props.js +41 -32
  15. package/dist/cjs/scope.js +1 -2
  16. package/dist/cjs/state.js +9 -8
  17. package/dist/cjs/string.js +15 -20
  18. package/dist/cjs/tags.js +69 -4
  19. package/dist/cjs/triggerEvent.js +90 -0
  20. package/dist/cjs/types.js +4 -12
  21. package/dist/esm/array.js +11 -5
  22. package/dist/esm/component.js +4 -6
  23. package/dist/esm/element.js +8 -26
  24. package/dist/esm/extends.js +47 -49
  25. package/dist/esm/function.js +3 -3
  26. package/dist/esm/index.js +1 -0
  27. package/dist/esm/key.js +2 -2
  28. package/dist/esm/keys.js +30 -16
  29. package/dist/esm/methods.js +63 -42
  30. package/dist/esm/object.js +145 -149
  31. package/dist/esm/props.js +41 -48
  32. package/dist/esm/scope.js +1 -2
  33. package/dist/esm/state.js +17 -34
  34. package/dist/esm/string.js +15 -20
  35. package/dist/esm/tags.js +69 -4
  36. package/dist/esm/triggerEvent.js +70 -0
  37. package/dist/esm/types.js +4 -12
  38. package/dist/iife/index.js +2779 -0
  39. package/element.js +2 -2
  40. package/extends.js +28 -17
  41. package/function.js +4 -6
  42. package/index.js +1 -0
  43. package/keys.js +26 -16
  44. package/methods.js +63 -18
  45. package/object.js +142 -200
  46. package/package.json +33 -12
  47. package/props.js +42 -25
  48. package/state.js +7 -7
  49. package/string.js +20 -38
  50. package/tags.js +43 -4
  51. package/triggerEvent.js +76 -0
  52. package/types.js +4 -23
  53. package/dist/cjs/package.json +0 -4
package/package.json CHANGED
@@ -1,31 +1,52 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "3.2.3",
3
+ "version": "3.2.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "module": "index.js",
7
- "main": "index.js",
6
+ "module": "./dist/esm/index.js",
7
+ "main": "./dist/cjs/index.js",
8
8
  "exports": {
9
9
  ".": {
10
- "default": "./dist/esm/index.js",
11
10
  "import": "./dist/esm/index.js",
12
- "require": "./dist/cjs/index.js"
11
+ "require": "./dist/cjs/index.js",
12
+ "browser": "./dist/iife/index.js",
13
+ "default": "./dist/esm/index.js"
14
+ },
15
+ "./methods": {
16
+ "import": "./dist/esm/methods.js",
17
+ "require": "./dist/cjs/methods.js",
18
+ "default": "./dist/esm/methods.js"
19
+ },
20
+ "./*.js": {
21
+ "import": "./dist/esm/*.js",
22
+ "require": "./dist/cjs/*.js",
23
+ "default": "./dist/esm/*.js"
24
+ },
25
+ "./*": {
26
+ "import": "./dist/esm/*.js",
27
+ "require": "./dist/cjs/*.js",
28
+ "default": "./dist/esm/*.js"
13
29
  }
14
30
  },
15
31
  "source": "index.js",
16
32
  "files": [
17
- "*.js",
18
- "dist"
33
+ "dist",
34
+ "*.js"
19
35
  ],
20
36
  "scripts": {
21
37
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
22
- "build:esm": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV",
23
- "build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs --define:process.env.NODE_ENV=process.env.NODE_ENV",
24
- "build": "npx rimraf -I dist; npm run build:cjs; npm run build:esm",
25
- "prepublish": "npm run build; npm run copy:package:cjs"
38
+ "build:esm": "cross-env NODE_ENV=$NODE_ENV esbuild *.js --target=es2020 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV",
39
+ "build:cjs": "cross-env NODE_ENV=$NODE_ENV esbuild *.js --target=node18 --format=cjs --outdir=dist/cjs --define:process.env.NODE_ENV=process.env.NODE_ENV",
40
+ "build": "node ../../build/build.js",
41
+ "prepublish": "npm run build && npm run copy:package:cjs",
42
+ "build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=DomqlUtils --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV --external:@domql/element"
26
43
  },
27
44
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
28
45
  "devDependencies": {
29
46
  "@babel/core": "^7.26.0"
30
- }
47
+ },
48
+ "browser": "./dist/iife/index.js",
49
+ "unpkg": "./dist/iife/index.js",
50
+ "jsdelivr": "./dist/iife/index.js",
51
+ "sideEffects": false
31
52
  }
package/props.js CHANGED
@@ -4,11 +4,14 @@ import { DOMQ_PROPERTIES, PROPS_METHODS } from './keys.js'
4
4
  import { addEventFromProps } from './events.js'
5
5
  import { deepClone, deepMerge, exec } from './object.js'
6
6
  import { is, isArray, isFunction, isObject, isObjectLike } from './types.js'
7
+ import { lowercaseFirstLetter } from './string.js'
8
+
9
+ const RE_UPPER = /^[A-Z]/
10
+ const RE_DIGITS = /^\d+$/
7
11
 
8
12
  export const createProps = (element, parent, key) => {
9
13
  const { props, __ref: ref } = element
10
14
  ref.__propsStack = []
11
- // if (props !== undefined) ref.__initialProps = props
12
15
  if (props) ref.__initialProps = props
13
16
  else return {}
14
17
  if (!isObjectLike(props)) {
@@ -24,10 +27,19 @@ export function pickupPropsFromElement (obj, opts = {}) {
24
27
  for (const key in obj) {
25
28
  const value = obj[key]
26
29
 
30
+ // Move top-level onXxx handlers directly into on.xxx (v3 style)
31
+ const isEventHandler = key.length > 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key[2] === key[2].toUpperCase() && isFunction(value)
32
+ if (isEventHandler) {
33
+ const eventName = lowercaseFirstLetter(key.slice(2))
34
+ if (obj.on) obj.on[eventName] = value
35
+ delete obj[key]
36
+ continue
37
+ }
38
+
27
39
  const hasDefine = isObject(this.define?.[key])
28
40
  const hasGlobalDefine = isObject(this.context?.define?.[key])
29
- const isElement = /^[A-Z]/.test(key) || /^\d+$/.test(key)
30
- const isBuiltin = DOMQ_PROPERTIES.includes(key)
41
+ const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key)
42
+ const isBuiltin = DOMQ_PROPERTIES.has(key)
31
43
 
32
44
  // If it's not a special case, move to props
33
45
  if (!isElement && !isBuiltin && !hasDefine && !hasGlobalDefine) {
@@ -47,7 +59,7 @@ export function pickupElementFromProps (obj = this, opts) {
47
59
  const value = obj.props[key]
48
60
 
49
61
  // Handle event handlers
50
- const isEvent = key.startsWith('on') && key.length > 2
62
+ const isEvent = key.length > 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110
51
63
  const isFn = isFunction(value)
52
64
 
53
65
  if (isEvent && isFn) {
@@ -61,14 +73,19 @@ export function pickupElementFromProps (obj = this, opts) {
61
73
 
62
74
  const hasDefine = isObject(this.define?.[key])
63
75
  const hasGlobalDefine = isObject(this.context?.define?.[key])
64
- const isElement = /^[A-Z]/.test(key) || /^\d+$/.test(key)
65
- const isBuiltin = DOMQ_PROPERTIES.includes(key)
76
+ const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key)
77
+ const isBuiltin = DOMQ_PROPERTIES.has(key)
66
78
 
67
79
  // Move qualifying properties back to obj root
68
80
  if (isElement || isBuiltin || hasDefine || hasGlobalDefine) {
69
- obj[key] = value
70
-
71
- if (obj.props) delete obj.props[key]
81
+ // Don't overwrite if root already has this property explicitly set
82
+ // Exception: null values should override to allow nullifying children from props
83
+ if (obj[key] === undefined || value === null) {
84
+ obj[key] = value
85
+ if (obj.props) delete obj.props[key]
86
+ }
87
+ // If root already has the property (e.g. from extends), keep it in props
88
+ // so functions like `text: ({ props }) => props.text` can still access it
72
89
  }
73
90
  }
74
91
 
@@ -84,8 +101,9 @@ export function propertizeElement (element = this) {
84
101
  }
85
102
 
86
103
  export function propertizeUpdate (params = {}) {
87
- const obj = deepMerge({ on: {}, props: {} }, params)
88
- return propertizeElement.call(this, obj)
104
+ if (!params.on) params.on = {}
105
+ if (!params.props) params.props = {}
106
+ return propertizeElement.call(this, params)
89
107
  }
90
108
 
91
109
  export const objectizeStringProperty = propValue => {
@@ -97,11 +115,7 @@ export const objectizeStringProperty = propValue => {
97
115
 
98
116
  export const propExists = (prop, stack) => {
99
117
  if (!prop || !stack.length) return false
100
- const key = isObject(prop) ? JSON.stringify(prop) : prop
101
- return stack.some(existing => {
102
- const existingKey = isObject(existing) ? JSON.stringify(existing) : existing
103
- return existingKey === key
104
- })
118
+ return stack.includes(prop)
105
119
  }
106
120
 
107
121
  export const inheritParentProps = (element, parent) => {
@@ -144,17 +158,16 @@ export const removeDuplicateProps = propsStack => {
144
158
  const seen = new Set()
145
159
 
146
160
  return propsStack.filter(prop => {
147
- if (!prop || PROPS_METHODS.includes(prop)) return false
148
- const key = isObject(prop) ? JSON.stringify(prop) : prop
149
- if (seen.has(key)) return false
150
- seen.add(key)
161
+ if (!prop || PROPS_METHODS.has(prop)) return false
162
+ if (seen.has(prop)) return false
163
+ seen.add(prop)
151
164
  return true
152
165
  })
153
166
  }
154
167
 
155
168
  export const syncProps = (propsStack, element, opts) => {
156
169
  element.props = propsStack.reduce((mergedProps, v) => {
157
- if (PROPS_METHODS.includes(v)) return mergedProps
170
+ if (PROPS_METHODS.has(v)) return mergedProps
158
171
  while (isFunction(v)) v = exec(v, element)
159
172
  return deepMerge(mergedProps, deepClone(v, { exclude: PROPS_METHODS }))
160
173
  }, {})
@@ -169,7 +182,7 @@ export const createPropsStack = (element, parent) => {
169
182
  let propsStack = ref.__propsStack || []
170
183
 
171
184
  // Get parent props
172
- if (parent && parent.props) {
185
+ if (parent?.props) {
173
186
  const parentStack = inheritParentProps(element, parent)
174
187
  propsStack = [...parentStack]
175
188
  }
@@ -181,11 +194,12 @@ export const createPropsStack = (element, parent) => {
181
194
 
182
195
  // Add extends props
183
196
  if (isArray(ref.__extendsStack)) {
184
- ref.__extendsStack.forEach(_extends => {
197
+ for (let i = 0; i < ref.__extendsStack.length; i++) {
198
+ const _extends = ref.__extendsStack[i]
185
199
  if (_extends.props && _extends.props !== props) {
186
200
  propsStack.push(_extends.props)
187
201
  }
188
- })
202
+ }
189
203
  }
190
204
 
191
205
  // Remove duplicates and update reference
@@ -215,7 +229,10 @@ export const initProps = function (element, parent, options) {
215
229
  else {
216
230
  try {
217
231
  applyProps(element, parent)
218
- } catch {
232
+ } catch (e) {
233
+ if (element.context?.designSystem?.verbose) {
234
+ console.warn('initProps error at', ref.path?.join('.'), e)
235
+ }
219
236
  element.props = {}
220
237
  ref.__propsStack = []
221
238
  }
package/state.js CHANGED
@@ -14,8 +14,7 @@ import {
14
14
  isFunction,
15
15
  isObject,
16
16
  isObjectLike,
17
- isString,
18
- isUndefined
17
+ isString
19
18
  } from './types.js'
20
19
 
21
20
  export const checkForStateTypes = element => {
@@ -101,7 +100,7 @@ export const findInheritedState = (element, parent, options = {}) => {
101
100
  export const createInheritedState = (element, parent) => {
102
101
  const ref = element.__ref
103
102
  const inheritedState = findInheritedState(element, parent)
104
- if (isUndefined(inheritedState)) return element.state
103
+ if (inheritedState === undefined) return element.state
105
104
 
106
105
  if (is(inheritedState)('object', 'array')) {
107
106
  return deepClone(inheritedState)
@@ -158,10 +157,11 @@ export const createNestedObjectByKeyPath = (path, value) => {
158
157
  const keys = path.split('/')
159
158
  const obj = {}
160
159
  let ref = obj
161
- keys.forEach((key, index) => {
162
- ref[key] = index === keys.length - 1 ? value || {} : {}
163
- ref = ref[key]
164
- })
160
+ const lastIdx = keys.length - 1
161
+ for (let i = 0; i <= lastIdx; i++) {
162
+ ref[keys[i]] = i === lastIdx ? value || {} : {}
163
+ ref = ref[keys[i]]
164
+ }
165
165
  return obj
166
166
  }
167
167
 
package/string.js CHANGED
@@ -31,17 +31,17 @@ const brackRegex = {
31
31
 
32
32
  const getNestedValue = (obj, path) => {
33
33
  return path.split('.').reduce((acc, part) => {
34
- return acc && acc[part] !== undefined ? acc[part] : undefined
34
+ return acc?.[part]
35
35
  }, obj)
36
36
  }
37
37
 
38
- export function replaceLiteralsWithObjectFields (str, state = {}, options = {}) {
38
+ export function replaceLiteralsWithObjectFields (str, state, options = {}) {
39
39
  const { bracketsLength = 2 } = options
40
40
  const bracketPattern = bracketsLength === 3 ? '{{{' : '{{'
41
41
  if (!str.includes(bracketPattern)) return str
42
42
 
43
43
  const reg = brackRegex[bracketsLength]
44
- const obj = state || {}
44
+ const obj = state || this.state || {}
45
45
 
46
46
  return str.replace(reg, (_, parentPath, variable) => {
47
47
  if (parentPath) {
@@ -56,14 +56,14 @@ export function replaceLiteralsWithObjectFields (str, state = {}, options = {})
56
56
  // If the variable is 'parent', return the value property
57
57
  const key = variable.trim()
58
58
  if (key === 'parent') {
59
- return parentState.value !== undefined ? String(parentState.value) : ''
59
+ return String(parentState.value ?? '')
60
60
  }
61
61
 
62
62
  const value = getNestedValue(parentState, key)
63
- return value !== undefined ? String(value) : ''
63
+ return String(value ?? '')
64
64
  } else {
65
65
  const value = getNestedValue(obj, variable.trim())
66
- return value !== undefined ? String(value) : ''
66
+ return String(value ?? '')
67
67
  }
68
68
  })
69
69
  }
@@ -131,50 +131,32 @@ export const findKeyPosition = (str, key) => {
131
131
  }
132
132
  }
133
133
 
134
+ const RE_OCTAL = /\\([0-7]{1,3})/g
135
+
134
136
  export const replaceOctalEscapeSequences = str => {
135
- // Regex to match octal escape sequences
136
- const octalRegex = /\\([0-7]{1,3})/g
137
-
138
- // Replace each match with the corresponding character
139
- return str.replace(octalRegex, (match, p1) => {
140
- // Convert the octal value to a decimal integer
141
- const octalValue = parseInt(p1, 8)
142
- // Convert the decimal value to the corresponding character
143
- const char = String.fromCharCode(octalValue)
144
- return char
145
- })
137
+ return str.replace(RE_OCTAL, (_, p1) => String.fromCharCode(parseInt(p1, 8)))
146
138
  }
147
139
 
148
140
  export const encodeNewlines = str => {
149
141
  return str
150
- .split('\n')
151
- .join('/////n')
152
- .split('`')
153
- .join('/////tilde')
154
- .split('$')
155
- .join('/////dlrsgn')
142
+ .replace(/\n/g, '/////n')
143
+ .replace(/`/g, '/////tilde')
144
+ .replace(/\$/g, '/////dlrsgn')
156
145
  }
157
146
 
158
147
  export const decodeNewlines = encodedStr => {
159
148
  return encodedStr
160
- .split('/////n')
161
- .join('\n')
162
- .split('/////tilde')
163
- .join('`')
164
- .split('/////dlrsgn')
165
- .join('$')
149
+ .replace(/\/\/\/\/\/n/g, '\n')
150
+ .replace(/\/\/\/\/\/tilde/g, '`')
151
+ .replace(/\/\/\/\/\/dlrsgn/g, '$')
166
152
  }
167
153
 
154
+ const RE_NON_ALNUM = /[^a-zA-Z0-9\s]/g
155
+
168
156
  export const customEncodeURIComponent = str => {
169
- return str
170
- .split('')
171
- .map(char => {
172
- if (/[^a-zA-Z0-9\s]/.test(char)) {
173
- return '%' + char.charCodeAt(0).toString(16).toUpperCase()
174
- }
175
- return char
176
- })
177
- .join('')
157
+ return str.replace(RE_NON_ALNUM, char =>
158
+ '%' + char.charCodeAt(0).toString(16).toUpperCase()
159
+ )
178
160
  }
179
161
 
180
162
  export const customDecodeURIComponent = encodedStr => {
package/tags.js CHANGED
@@ -5,7 +5,7 @@ export const HTML_TAGS = {
5
5
 
6
6
  head: ['title', 'base', 'meta', 'style', 'noscript', 'script'],
7
7
 
8
- body: [
8
+ body: new Set([
9
9
  'string',
10
10
  'style',
11
11
  'fragment',
@@ -130,8 +130,47 @@ export const HTML_TAGS = {
130
130
 
131
131
  // SVG
132
132
  'svg',
133
- 'path'
134
- ]
133
+ 'path',
134
+ 'circle',
135
+ 'ellipse',
136
+ 'line',
137
+ 'polygon',
138
+ 'polyline',
139
+ 'rect',
140
+ 'g',
141
+ 'defs',
142
+ 'symbol',
143
+ 'use',
144
+ 'text',
145
+ 'tspan',
146
+ 'image',
147
+ 'clipPath',
148
+ 'mask',
149
+ 'pattern',
150
+ 'marker',
151
+ 'linearGradient',
152
+ 'radialGradient',
153
+ 'stop',
154
+ 'filter',
155
+ 'feGaussianBlur',
156
+ 'feOffset',
157
+ 'feMerge',
158
+ 'feMergeNode',
159
+ 'feBlend',
160
+ 'feColorMatrix',
161
+ 'feFlood',
162
+ 'feComposite',
163
+ 'foreignObject'
164
+ ])
135
165
  }
136
166
 
137
- export const isValidHtmlTag = arg => HTML_TAGS.body.includes(arg)
167
+ export const SVG_TAGS = new Set([
168
+ 'svg', 'path', 'circle', 'ellipse', 'line', 'polygon', 'polyline',
169
+ 'rect', 'g', 'defs', 'symbol', 'use', 'text', 'tspan', 'image',
170
+ 'clipPath', 'mask', 'pattern', 'marker', 'linearGradient',
171
+ 'radialGradient', 'stop', 'filter', 'feGaussianBlur', 'feOffset',
172
+ 'feMerge', 'feMergeNode', 'feBlend', 'feColorMatrix', 'feFlood',
173
+ 'feComposite', 'foreignObject'
174
+ ])
175
+
176
+ export const isValidHtmlTag = arg => HTML_TAGS.body.has(arg)
@@ -0,0 +1,76 @@
1
+ 'use strict'
2
+
3
+ import { isFunction } from './types.js'
4
+
5
+ const getOnOrPropsEvent = (param, element) => {
6
+ const onEvent = element.on?.[param]
7
+ if (onEvent) return onEvent
8
+ const props = element.props
9
+ if (!props) return
10
+ const propKey = 'on' + param.charAt(0).toUpperCase() + param.slice(1)
11
+ return props[propKey]
12
+ }
13
+
14
+ export const applyEvent = (param, element, state, context, options) => {
15
+ if (!isFunction(param)) return
16
+ const result = param.call(
17
+ element,
18
+ element,
19
+ state || element.state,
20
+ context || element.context,
21
+ options
22
+ )
23
+ if (result && typeof result.then === 'function') {
24
+ result.catch(() => {})
25
+ }
26
+ return result
27
+ }
28
+
29
+ export const triggerEventOn = (param, element, options) => {
30
+ if (!element) {
31
+ throw new Error('Element is required')
32
+ }
33
+ const appliedFunction = getOnOrPropsEvent(param, element)
34
+ if (appliedFunction) {
35
+ const { state, context } = element
36
+ return applyEvent(appliedFunction, element, state, context, options)
37
+ }
38
+ }
39
+
40
+ export const applyEventUpdate = (
41
+ param,
42
+ updatedObj,
43
+ element,
44
+ state,
45
+ context,
46
+ options
47
+ ) => {
48
+ if (!isFunction(param)) return
49
+ const result = param.call(
50
+ element,
51
+ updatedObj,
52
+ element,
53
+ state || element.state,
54
+ context || element.context,
55
+ options
56
+ )
57
+ if (result && typeof result.then === 'function') {
58
+ result.catch(() => {})
59
+ }
60
+ return result
61
+ }
62
+
63
+ export const triggerEventOnUpdate = (param, updatedObj, element, options) => {
64
+ const appliedFunction = getOnOrPropsEvent(param, element)
65
+ if (appliedFunction) {
66
+ const { state, context } = element
67
+ return applyEventUpdate(
68
+ appliedFunction,
69
+ updatedObj,
70
+ element,
71
+ state,
72
+ context,
73
+ options
74
+ )
75
+ }
76
+ }
package/types.js CHANGED
@@ -27,24 +27,9 @@ export const isObjectLike = arg => {
27
27
  return typeof arg === 'object'
28
28
  }
29
29
 
30
- export const isDefined = arg => {
31
- return (
32
- isObject(arg) ||
33
- isObjectLike(arg) ||
34
- isString(arg) ||
35
- isNumber(arg) ||
36
- isFunction(arg) ||
37
- isArray(arg) ||
38
- isObjectLike(arg) ||
39
- isBoolean(arg) ||
40
- isDate(arg) ||
41
- isNull(arg)
42
- )
43
- }
30
+ export const isDefined = arg => arg !== undefined
44
31
 
45
- export const isUndefined = arg => {
46
- return arg === undefined
47
- }
32
+ export const isUndefined = arg => arg === undefined
48
33
 
49
34
  export const TYPES = {
50
35
  boolean: isBoolean,
@@ -62,13 +47,9 @@ export const TYPES = {
62
47
  }
63
48
 
64
49
  export const is = arg => {
65
- return (...args) => {
66
- return args.map(val => TYPES[val](arg)).filter(v => v).length > 0
67
- }
50
+ return (...args) => args.some(val => TYPES[val](arg))
68
51
  }
69
52
 
70
53
  export const isNot = arg => {
71
- return (...args) => {
72
- return args.map(val => TYPES[val](arg)).filter(v => v).length === 0
73
- }
54
+ return (...args) => !args.some(val => TYPES[val](arg))
74
55
  }
@@ -1,4 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "main": "index.js"
4
- }