pp-is 1.0.9 → 1.2.0
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/package.json +4 -2
- package/pp-is.js +10 -4
- package/pp-is.min.js +1 -1
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.0
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"main": "pp-is.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"compile": "terser --output pp-is.min.js --compress --mangle --comments false -- pp-is.js"
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"isEmail",
|
|
26
26
|
"isNaN",
|
|
27
27
|
"isRegExp",
|
|
28
|
-
"isUrl"
|
|
28
|
+
"isUrl",
|
|
29
|
+
"isHTMLCollection",
|
|
30
|
+
"isNodeList"
|
|
29
31
|
],
|
|
30
32
|
"author": "Carlos Illesca",
|
|
31
33
|
"license": "MIT",
|
package/pp-is.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!!
|
|
2
2
|
* Power Panel pp-is <https://github.com/carlos-sweb/pp-is>
|
|
3
3
|
* @author Carlos Illesca
|
|
4
|
-
* @version 1.0
|
|
4
|
+
* @version 1.2.0 (2024/02/26 15:00 PM)
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
7
|
(function(global,factory){
|
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
})(this,function(){
|
|
15
15
|
// =======================================================================
|
|
16
16
|
function getType( value ){ return Object.prototype.toString.call(value) }
|
|
17
|
-
// =======================================================================
|
|
17
|
+
// =======================================================================
|
|
18
|
+
function isNodeList( value ){ return NodeList.prototype.isPrototypeOf(value) }
|
|
19
|
+
// =======================================================================
|
|
20
|
+
function isHTMLCollection( value ){ return HTMLCollection.prototype.isPrototypeOf(value) }
|
|
21
|
+
// =======================================================================
|
|
18
22
|
function isArray ( value ){ return getType( value ) === '[object Array]'}
|
|
19
23
|
// =======================================================================
|
|
20
24
|
function isRegExp ( value ){ return getType( value ) === '[object RegExp]'}
|
|
@@ -38,7 +42,7 @@
|
|
|
38
42
|
function isUndefined( value ){ return getType( value ) === '[object Undefined]'}
|
|
39
43
|
// =======================================================================
|
|
40
44
|
function isEmpty( value ){
|
|
41
|
-
if(
|
|
45
|
+
if(isString(value)){ return value === ""; }
|
|
42
46
|
if(isArray(value) ){ return value.length == 0; }
|
|
43
47
|
if(isObject(value) ){ return Object.keys(value).length === 0;}
|
|
44
48
|
return true;
|
|
@@ -86,6 +90,8 @@
|
|
|
86
90
|
'isEmail':base(isEmail),
|
|
87
91
|
'isNaN':base(isNaN),
|
|
88
92
|
'isRegExp':base(isRegExp),
|
|
89
|
-
'isUrl':base(isUrl)
|
|
93
|
+
'isUrl':base(isUrl),
|
|
94
|
+
'isNodeList':base(isNodeList),
|
|
95
|
+
'isHTMLCollection':base(isHTMLCollection)
|
|
90
96
|
}
|
|
91
97
|
})
|
package/pp-is.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(n
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define("ppIs",n):(t=t||self).ppIs=n()}(this,(function(){function t(t){return Object.prototype.toString.call(t)}function n(n){return"[object Array]"===t(n)}function e(n){return"[object Function]"===t(n)}function o(n){return"[object Object]"===t(n)}function i(n){return"[object String]"===t(n)}var r=function(t){return function(n,o){return e(o)?t(n)?o(n):void 0:t(n)}};return{isArray:r(n),isBoolean:r((function(n){return!0===n||!1===n||"[object Boolean]"===t(n)})),isDate:r((function(n){return"[object Date]"===t(n)})),isElement:r((function(t){return!(!t||1!==t.nodeType)})),isEmpty:r((function(t){return i(t)?""===t:n(t)?0==t.length:!o(t)||0===Object.keys(t).length})),isFunction:r(e),isNull:r((function(n){return"[object Null]"===t(n)})),isNumber:r((function(n){return"[object Number]"===t(n)})),isObject:r(o),isString:r(i),isUndefined:r((function(n){return"[object Undefined]"===t(n)})),isEmail:r((function(t){return/^([a-z0-9_-]+[a-z0-9._-]+?)@([a-z0-9-]+\.[a-z]{2,6}|[a-z0-9]+\.[a-z]{2,6}\.[a-z]{2,6})$/i.test(t)})),isNaN:r((function(t){return Number.isNaN(parseInt(t))})),isRegExp:r((function(n){return"[object RegExp]"===t(n)})),isUrl:r((function(t){return/^(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(t)})),isNodeList:r((function(t){return NodeList.prototype.isPrototypeOf(t)})),isHTMLCollection:r((function(t){return HTMLCollection.prototype.isPrototypeOf(t)}))}}));
|