pp-is 1.2.4 → 1.2.6
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/LICENSE.txt +1 -1
- package/README.md +19 -1
- package/README_es.md +19 -1
- package/dist/main/isBlank.js +10 -0
- package/dist/main/isEmpty.js +1 -1
- package/dist/main/isNaN.js +1 -1
- package/dist/main/isNumber.js +2 -1
- package/dist/main/isPromise.js +9 -0
- package/dist/pp-is.js +7 -3
- package/dist/pp-is.min.js +1 -1
- package/package.json +4 -2
package/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Carlos Enrique Illesca Monsalve
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
In the web project include pp-is.js with:
|
|
6
6
|
|
|
7
7
|
```html
|
|
8
|
-
<script src="https://cdn.jsdelivr.net/npm/pp-is@1.2.
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/pp-is@1.2.5/pp-is.min.js" ></script>
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Or
|
|
@@ -106,6 +106,24 @@ Checks if value is a valid HTMLCollection.
|
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
109
|
+
#### `isEmpty`
|
|
110
|
+
|
|
111
|
+
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 {}.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
#### `isBlank`
|
|
116
|
+
|
|
117
|
+
Check that a value is blank, which is when a string is not empty but filled with blank spaces.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
#### `isPromise`
|
|
122
|
+
|
|
123
|
+
Checks if value is classified as an Promise object.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
109
127
|
## How to use ?
|
|
110
128
|
|
|
111
129
|
```javascript
|
package/README_es.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Incluye pp-is.js en tu proyecto web:
|
|
6
6
|
```html
|
|
7
|
-
<script src="https://cdn.jsdelivr.net/npm/pp-is@1.2.
|
|
7
|
+
<script src="https://cdn.jsdelivr.net/npm/pp-is@1.2.5/pp-is.min.js" ></script>
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
O
|
|
@@ -106,6 +106,24 @@ Verifica si el valor es un HTTMLCollection valido.
|
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
109
|
+
#### `isEmpty`
|
|
110
|
+
|
|
111
|
+
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 {}
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
#### `isBlank`
|
|
116
|
+
|
|
117
|
+
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.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
#### `isPromise`
|
|
122
|
+
|
|
123
|
+
Comprueba si el valor está clasificado como un objeto Promise.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
109
127
|
## ¿ Como se usa ?
|
|
110
128
|
|
|
111
129
|
```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
|
package/dist/main/isNaN.js
CHANGED
package/dist/main/isNumber.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import getTypeCompare from "./../helper/getTypeCompare.js"
|
|
2
|
+
import isNaN from "./isNaN.js"
|
|
2
3
|
/**
|
|
3
4
|
* @function isNumber
|
|
4
5
|
* @description - Checks if value is a Number.
|
|
5
6
|
* @param { Any } value - Any value
|
|
6
7
|
* @return {boolean}
|
|
7
8
|
*/
|
|
8
|
-
const isNumber=(value)=>getTypeCompare(value,'Number')
|
|
9
|
+
const isNumber=(value)=>getTypeCompare(value,'Number') && !isNaN(value)
|
|
9
10
|
export { isNumber as default }
|
|
10
11
|
|
|
@@ -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.6 (2025/06/02 21:43 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,8 +15,8 @@ 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"
|
|
16
|
-
import isNumber from "./main/isNumber.js"
|
|
17
18
|
import isNaN from "./main/isNaN.js"
|
|
19
|
+
import isNumber from "./main/isNumber.js"
|
|
18
20
|
import isEmail from "./main/isEmail.js"
|
|
19
21
|
import isUrl from "./main/isUrl.js"
|
|
20
22
|
import isEmpty from "./main/isEmpty.js"
|
|
@@ -46,12 +48,13 @@ import base from "./helper/base.js"
|
|
|
46
48
|
* @property {function} isFreeModule - {@link isFreeModule}
|
|
47
49
|
* @property {function} getRoot - {@link getRoot}
|
|
48
50
|
*/
|
|
49
|
-
const is = {
|
|
51
|
+
const is = {
|
|
50
52
|
'isArray':base(isArray),
|
|
51
53
|
'isBoolean':base(isBoolean),
|
|
52
54
|
'isDate':base(isDate),
|
|
53
55
|
'isElement':base(isElement),
|
|
54
56
|
'isEmpty':base(isEmpty),
|
|
57
|
+
'isBlank':base(isBlank),
|
|
55
58
|
'isFunction':base(isFunction),
|
|
56
59
|
'isNull':base(isNull),
|
|
57
60
|
'isNumber':base(isNumber),
|
|
@@ -64,6 +67,7 @@ import base from "./helper/base.js"
|
|
|
64
67
|
'isUrl':base(isUrl),
|
|
65
68
|
'isNodeList':base(isNodeList),
|
|
66
69
|
'isHTMLCollection':base(isHTMLCollection),
|
|
70
|
+
'isPromise':base(isPromise)
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
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"),n=t=>!0===t||!1===t||e(t,"Boolean"),s=t=>e(t,"Function"),d=(e,t,i)=>{const o=e(t);return n(o)?o:i},l=e=>(t,i,o)=>((e,t,i,o)=>{const n=e(t);return n?!s(i)||
|
|
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"),n=t=>!0===t||!1===t||e(t,"Boolean"),s=t=>e(t,"Function"),d=e=>Number.isNaN(Number.parseInt(e)),r=(e,t,i)=>{const o=e(t);return n(o)?o:i},l=e=>(t,i,o)=>((e,t,i,o)=>{const n=e(t);return n?!s(i)||r(i,t,n):!!s(o)&&r(o,t,n)})(e,t,i,o);return{isArray:l(i),isBoolean:l(n),isDate:l((t=>e(t,"Date"))),isElement:l((e=>!(!e||1!==e.nodeType))),isEmpty:l((e=>t(e)?""===e:i(e)?0==e.length:!o(e)||0===Object.keys(e).length)),isBlank:l((e=>!!t(e)&&(""===e||""===e.trim()))),isFunction:l(s),isNull:l((t=>e(t,"Null"))),isNumber:l((t=>e(t,"Number")&&!d(t))),isObject:l(o),isString:l(t),isUndefined:l((t=>e(t,"Undefined"))),isEmail:l((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:l(d),isRegExp:l((t=>e(t,"RegExp"))),isUrl:l((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:l((e=>"undefined"!=typeof NodeList&&NodeList.prototype.isPrototypeOf(e))),isHTMLCollection:l((e=>"undefined"!=typeof HTMLCollection&&HTMLCollection.prototype.isPrototypeOf(e))),isPromise:l((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.6",
|
|
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,9 @@
|
|
|
31
31
|
"isRegExp",
|
|
32
32
|
"isUrl",
|
|
33
33
|
"isHTMLCollection",
|
|
34
|
-
"isNodeList"
|
|
34
|
+
"isNodeList",
|
|
35
|
+
"isBlank",
|
|
36
|
+
"isPromise"
|
|
35
37
|
],
|
|
36
38
|
"author": "Carlos Illesca",
|
|
37
39
|
"license": "MIT",
|