pp-is 1.2.5 → 1.2.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.
- package/README.md +23 -0
- package/README_es.md +23 -0
- package/dist/main/isBlank.js +10 -0
- package/dist/main/isEmpty.js +1 -1
- package/dist/main/isNil.js +11 -0
- package/dist/main/isPromise.js +9 -0
- package/dist/pp-is.js +8 -2
- package/dist/pp-is.min.js +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -46,6 +46,11 @@ Checks if value is a Function.
|
|
|
46
46
|
|
|
47
47
|
Checks if value is a Null.
|
|
48
48
|
|
|
49
|
+
---
|
|
50
|
+
#### `isNil`
|
|
51
|
+
|
|
52
|
+
Checks if value is a Null or Undefined
|
|
53
|
+
|
|
49
54
|
---
|
|
50
55
|
#### `isNumber`
|
|
51
56
|
|
|
@@ -106,6 +111,24 @@ Checks if value is a valid HTMLCollection.
|
|
|
106
111
|
|
|
107
112
|
---
|
|
108
113
|
|
|
114
|
+
#### `isEmpty`
|
|
115
|
+
|
|
116
|
+
Verify that a value is not empty, in the case of a string that is not “” , in the case of an array that is not \[\] and an object that is not {}.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
#### `isBlank`
|
|
121
|
+
|
|
122
|
+
Check that a value is blank, which is when a string is not empty but filled with blank spaces.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
#### `isPromise`
|
|
127
|
+
|
|
128
|
+
Checks if value is classified as an Promise object.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
109
132
|
## How to use ?
|
|
110
133
|
|
|
111
134
|
```javascript
|
package/README_es.md
CHANGED
|
@@ -46,6 +46,11 @@ Verifica si el valor es una función
|
|
|
46
46
|
|
|
47
47
|
Verifica si el valor es un nulo.
|
|
48
48
|
|
|
49
|
+
---
|
|
50
|
+
#### `isNil`
|
|
51
|
+
|
|
52
|
+
Verifica si el valor es un nulo o no definido.
|
|
53
|
+
|
|
49
54
|
---
|
|
50
55
|
#### `isNumber`
|
|
51
56
|
|
|
@@ -106,6 +111,24 @@ Verifica si el valor es un HTTMLCollection valido.
|
|
|
106
111
|
|
|
107
112
|
---
|
|
108
113
|
|
|
114
|
+
#### `isEmpty`
|
|
115
|
+
|
|
116
|
+
Verifica que un valor no este vacio , en caso de una cadena que sea distinta a "" , en caso de un arreglo que sea distinoto a [] y un objecto que sea distinto a {}
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
#### `isBlank`
|
|
121
|
+
|
|
122
|
+
Comprueba que un valor esté en blanco, lo cual ocurre cuando una cadena no está vacía, sino que está llena de espacios en blanco.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
#### `isPromise`
|
|
127
|
+
|
|
128
|
+
Comprueba si el valor está clasificado como un objeto Promise.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
109
132
|
## ¿ Como se usa ?
|
|
110
133
|
|
|
111
134
|
```javascript
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import isString from "./isString.js"
|
|
2
|
+
/**
|
|
3
|
+
* @function isBlack
|
|
4
|
+
* @description - Check that a value is blank, which is when a string is not empty but filled with blank spaces.
|
|
5
|
+
* @param { Any } value - Any Value
|
|
6
|
+
* @return {boolean}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const isBlank = (value)=>isString(value) ? ( value === "" || value.trim() === "" ) : false
|
|
10
|
+
export { isBlank as default }
|
package/dist/main/isEmpty.js
CHANGED
|
@@ -3,7 +3,7 @@ import isArray from "./isArray.js"
|
|
|
3
3
|
import isObject from "./isObject.js"
|
|
4
4
|
/**
|
|
5
5
|
* @function isEmpty
|
|
6
|
-
* @description -
|
|
6
|
+
* @description - Verify that a value is not empty, in the case of a string that is not “” , in the case of an array that is not [] and an object that is not {}.
|
|
7
7
|
* @param { Any } value - Any value
|
|
8
8
|
* @example
|
|
9
9
|
* // this a empty string
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import isUndefined from "./isUndefined.js"
|
|
2
|
+
import isNull from "./isNull.js"
|
|
3
|
+
/**
|
|
4
|
+
* @function isNil
|
|
5
|
+
* @description - Check that a value is undefined or null
|
|
6
|
+
* @param { Any } value - Any Value
|
|
7
|
+
* @return {boolean}
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const isNil = (value)=>isUndefined(value)||isNull(value)
|
|
11
|
+
export { isNil as default }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import getTypeCompare from "./../helper/getTypeCompare.js"
|
|
2
|
+
/**
|
|
3
|
+
* @function isPromise
|
|
4
|
+
* @description - Checks if value is classified as an Promise object.
|
|
5
|
+
* @param { Any } value - Any Value
|
|
6
|
+
* @return {boolean}
|
|
7
|
+
*/
|
|
8
|
+
const isPromise = (value)=> getTypeCompare(value,"Promise")
|
|
9
|
+
export { isPromise as default }
|
package/dist/pp-is.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/*!!
|
|
2
2
|
* Power Panel pp-is <https://github.com/carlos-sweb/pp-is>
|
|
3
3
|
* @author Carlos Illesca
|
|
4
|
-
* @version 1.2.
|
|
4
|
+
* @version 1.2.7 (2025/06/11 21:30 PM)
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
|
+
import isPromise from "./main/isPromise.js"
|
|
7
8
|
import isString from "./main/isString.js"
|
|
9
|
+
import isBlank from "./main/isBlank.js"
|
|
8
10
|
import isArray from "./main/isArray.js"
|
|
9
11
|
import isObject from "./main/isObject.js"
|
|
10
12
|
import isRegExp from "./main/isRegExp.js"
|
|
@@ -13,6 +15,7 @@ import isDate from "./main/isDate.js"
|
|
|
13
15
|
import isFunction from "./main/isFunction.js"
|
|
14
16
|
import isUndefined from "./main/isUndefined.js"
|
|
15
17
|
import isNull from "./main/isNull.js"
|
|
18
|
+
import isNil from "./main/isNil.js"
|
|
16
19
|
import isNaN from "./main/isNaN.js"
|
|
17
20
|
import isNumber from "./main/isNumber.js"
|
|
18
21
|
import isEmail from "./main/isEmail.js"
|
|
@@ -46,24 +49,27 @@ import base from "./helper/base.js"
|
|
|
46
49
|
* @property {function} isFreeModule - {@link isFreeModule}
|
|
47
50
|
* @property {function} getRoot - {@link getRoot}
|
|
48
51
|
*/
|
|
49
|
-
const is = {
|
|
52
|
+
const is = {
|
|
50
53
|
'isArray':base(isArray),
|
|
51
54
|
'isBoolean':base(isBoolean),
|
|
52
55
|
'isDate':base(isDate),
|
|
53
56
|
'isElement':base(isElement),
|
|
54
57
|
'isEmpty':base(isEmpty),
|
|
58
|
+
'isBlank':base(isBlank),
|
|
55
59
|
'isFunction':base(isFunction),
|
|
56
60
|
'isNull':base(isNull),
|
|
57
61
|
'isNumber':base(isNumber),
|
|
58
62
|
'isObject':base(isObject),
|
|
59
63
|
'isString':base(isString),
|
|
60
64
|
'isUndefined':base(isUndefined),
|
|
65
|
+
'isNil':base(isNil),
|
|
61
66
|
'isEmail':base(isEmail),
|
|
62
67
|
'isNaN':base(isNaN),
|
|
63
68
|
'isRegExp':base(isRegExp),
|
|
64
69
|
'isUrl':base(isUrl),
|
|
65
70
|
'isNodeList':base(isNodeList),
|
|
66
71
|
'isHTMLCollection':base(isHTMLCollection),
|
|
72
|
+
'isPromise':base(isPromise)
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
export { is as default }
|
package/dist/pp-is.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ppIs=t()}(this,(function(){"use strict";const e=(e,t)=>(e=>Object.prototype.toString.call(e))(e)==="[object "+t+"]",t=t=>e(t,"String"),i=t=>e(t,"Array"),o=t=>e(t,"Object"),
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).ppIs=t()}(this,(function(){"use strict";const e=(e,t)=>(e=>Object.prototype.toString.call(e))(e)==="[object "+t+"]",t=t=>e(t,"String"),i=t=>e(t,"Array"),o=t=>e(t,"Object"),s=t=>!0===t||!1===t||e(t,"Boolean"),n=t=>e(t,"Function"),d=t=>e(t,"Undefined"),l=t=>e(t,"Null"),r=e=>Number.isNaN(Number.parseInt(e)),a=(e,t,i)=>{const o=e(t);return s(o)?o:i},p=e=>(t,i,o)=>((e,t,i,o)=>{const s=e(t);return s?!n(i)||a(i,t,s):!!n(o)&&a(o,t,s)})(e,t,i,o);return{isArray:p(i),isBoolean:p(s),isDate:p((t=>e(t,"Date"))),isElement:p((e=>!(!e||1!==e.nodeType))),isEmpty:p((e=>t(e)?""===e:i(e)?0==e.length:!o(e)||0===Object.keys(e).length)),isBlank:p((e=>!!t(e)&&(""===e||""===e.trim()))),isFunction:p(n),isNull:p(l),isNumber:p((t=>e(t,"Number")&&!r(t))),isObject:p(o),isString:p(t),isUndefined:p(d),isNil:p((e=>d(e)||l(e))),isEmail:p((e=>/^([a-z1-9\._-]+)@([a-z0-9-]+\.[a-z]{2,11}|[a-z0-9]+\.[a-z]{2,24}\.[a-z]{2,24})$/i.test(e))),isNaN:p(r),isRegExp:p((t=>e(t,"RegExp"))),isUrl:p((e=>/^(https?:\/\/)?([w]{3}\.|[w]{3}2\.)?([a-z\d]+\.)?([a-z\d]+\.[a-z]{2,}|localhost|[\d]+\.[\d]+\.[\d]+\.[\d]+)(\:[\d]+)?([\??\/?]+[\/;&a-z\d%_.~+=-]*)?(\#[\/;&a-z\d%_.~+=-]*)?$/gi.test(e))),isNodeList:p((e=>"undefined"!=typeof NodeList&&NodeList.prototype.isPrototypeOf(e))),isHTMLCollection:p((e=>"undefined"!=typeof HTMLCollection&&HTMLCollection.prototype.isPrototypeOf(e))),isPromise:p((t=>e(t,"Promise")))}}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pp-is",
|
|
3
3
|
"description": "Collection of methods for check",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.7",
|
|
5
5
|
"main": "dist/pp-is.min.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "rollup -c && terser -o ./dist/pp-is.min.js --compress --mangle --comments false -- ./dist/pp-is.rollup.js && rm -rf ./dist/pp-is.rollup.js",
|
|
@@ -31,7 +31,10 @@
|
|
|
31
31
|
"isRegExp",
|
|
32
32
|
"isUrl",
|
|
33
33
|
"isHTMLCollection",
|
|
34
|
-
"isNodeList"
|
|
34
|
+
"isNodeList",
|
|
35
|
+
"isBlank",
|
|
36
|
+
"isPromise",
|
|
37
|
+
"isNil"
|
|
35
38
|
],
|
|
36
39
|
"author": "Carlos Illesca",
|
|
37
40
|
"license": "MIT",
|