@magic/types 0.1.17 → 0.1.18
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/README.md +11 -1
- package/package.json +2 -2
- package/src/fns.mjs +8 -2
- package/src/lib.mjs +9 -0
package/README.md
CHANGED
|
@@ -200,6 +200,12 @@ isLowerCase('lowercase') // true
|
|
|
200
200
|
isMergeableObject({}) // true
|
|
201
201
|
// alias is.mergeable, is.mergeableObject, isMergeable
|
|
202
202
|
|
|
203
|
+
const mod = await import('path/to/file')
|
|
204
|
+
isModule(mod) // true
|
|
205
|
+
// alias is.module
|
|
206
|
+
|
|
207
|
+
isOwnProp({ test: undefined }, 'test') // true
|
|
208
|
+
// alias isOwnProperty, is.ownProperty, is.ownProp, is.prop
|
|
203
209
|
```
|
|
204
210
|
|
|
205
211
|
|
|
@@ -271,5 +277,9 @@ deep.equal now does return true for objects that have undefined property values
|
|
|
271
277
|
* add isSameType, isSame, same, sameType
|
|
272
278
|
* update dev dependencies
|
|
273
279
|
|
|
274
|
-
##### 0.1.18
|
|
280
|
+
##### 0.1.18
|
|
281
|
+
* add isModule and isOwnProperty
|
|
282
|
+
* update dependencies
|
|
283
|
+
|
|
284
|
+
##### 0.1.19 - unreleased
|
|
275
285
|
...
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic/types",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"author": "Wizards & Witches",
|
|
5
5
|
"homepage": "https://github.com/magic/types",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@magic-modules/pre": "0.0.11",
|
|
41
41
|
"@magic-themes/docs": "0.0.14",
|
|
42
42
|
"@magic/core": "0.0.133",
|
|
43
|
-
"@magic/format": "0.0.
|
|
43
|
+
"@magic/format": "0.0.35",
|
|
44
44
|
"@magic/test": "0.2.0"
|
|
45
45
|
},
|
|
46
46
|
"keywords": [
|
package/src/fns.mjs
CHANGED
|
@@ -79,7 +79,7 @@ export const isEmpty = e => {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export const getLength = arg => {
|
|
82
|
-
if (arg
|
|
82
|
+
if (isOwnProp(arg, 'length') && isNumber(arg.length)) {
|
|
83
83
|
return arg.length
|
|
84
84
|
} else if (isNumber(arg)) {
|
|
85
85
|
return arg
|
|
@@ -210,7 +210,13 @@ export const isWeakSet = a => isInstanceOf(a, WeakSet)
|
|
|
210
210
|
export const isUpperCase = s => (isString(s) ? s === s.toUpperCase() : false)
|
|
211
211
|
export const isLowerCase = s => (isString(s) ? s === s.toLowerCase() : false)
|
|
212
212
|
|
|
213
|
-
export const
|
|
213
|
+
export const isOwnProp = (o, k) =>
|
|
214
|
+
isDefined(o) && isFunction(o.hasOwnProperty) && o.hasOwnProperty(k)
|
|
215
|
+
|
|
216
|
+
export const isOwnProperty = isOwnProp
|
|
214
217
|
|
|
218
|
+
export const isModule = s => Object.prototype.toString.call(s) === '[object Module]'
|
|
219
|
+
|
|
220
|
+
export const isCase = (s, c = 'up') => (c === 'up' ? isUpperCase(s) : isLowerCase(s))
|
|
215
221
|
isCase.upper = isUpperCase
|
|
216
222
|
isCase.lower = isLowerCase
|
package/src/lib.mjs
CHANGED
|
@@ -262,6 +262,15 @@ export const is = {
|
|
|
262
262
|
sameType: fns.isSameType,
|
|
263
263
|
isSameType: fns.isSameType,
|
|
264
264
|
isSame: fns.isSameType,
|
|
265
|
+
|
|
266
|
+
ownProp: fns.isOwnProp,
|
|
267
|
+
prop: fns.isOwnProp,
|
|
268
|
+
ownProperty: fns.isOwnProp,
|
|
269
|
+
isOwnProp: fns.isOwnProp,
|
|
270
|
+
isOwnProperty: fns.isOwnProp,
|
|
271
|
+
|
|
272
|
+
isModule: fns.isModule,
|
|
273
|
+
module: fns.isModule,
|
|
265
274
|
}
|
|
266
275
|
|
|
267
276
|
// assign ln as properties of the getLength function
|