pp-is 1.0.8 → 1.0.9
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 +1 -1
- package/pp-is.js +19 -19
- package/pp-is.min.js +1 -1
package/package.json
CHANGED
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.0.9 (2022/09/11 23:09 PM)
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
7
|
(function(global,factory){
|
|
@@ -12,42 +12,42 @@
|
|
|
12
12
|
}()
|
|
13
13
|
));
|
|
14
14
|
})(this,function(){
|
|
15
|
+
// =======================================================================
|
|
16
|
+
function getType( value ){ return Object.prototype.toString.call(value) }
|
|
15
17
|
// =======================================================================
|
|
16
|
-
|
|
17
|
-
// =======================================================================
|
|
18
|
-
isArray = ( value ) => getType( value ) === '[object Array]';
|
|
18
|
+
function isArray ( value ){ return getType( value ) === '[object Array]'}
|
|
19
19
|
// =======================================================================
|
|
20
|
-
isRegExp
|
|
20
|
+
function isRegExp ( value ){ return getType( value ) === '[object RegExp]'}
|
|
21
21
|
// =======================================================================
|
|
22
|
-
isBoolean
|
|
22
|
+
function isBoolean( value ){ return value === true || value === false || getType( value ) === '[object Boolean]'};
|
|
23
23
|
// =======================================================================
|
|
24
|
-
isDate
|
|
24
|
+
function isDate( value ){ return getType( value ) === '[object Date]'}
|
|
25
25
|
// =======================================================================
|
|
26
|
-
isElement
|
|
26
|
+
function isElement( value ){ return !!( value && value.nodeType === 1 ) }
|
|
27
27
|
// =======================================================================
|
|
28
|
-
isFunction
|
|
28
|
+
function isFunction( value ) { return getType( value ) === '[object Function]'}
|
|
29
29
|
// =======================================================================
|
|
30
|
-
isNull
|
|
30
|
+
function isNull( value ){ return getType( value ) === '[object Null]'}
|
|
31
31
|
// =======================================================================
|
|
32
|
-
isNumber
|
|
32
|
+
function isNumber( value ){ return getType( value ) === '[object Number]'}
|
|
33
33
|
// =======================================================================
|
|
34
|
-
isObject
|
|
34
|
+
function isObject( value ){ return getType( value ) === '[object Object]'}
|
|
35
35
|
// =======================================================================
|
|
36
|
-
isString
|
|
36
|
+
function isString( value ){ return getType( value ) === '[object String]'}
|
|
37
37
|
// =======================================================================
|
|
38
|
-
isUndefined
|
|
38
|
+
function isUndefined( value ){ return getType( value ) === '[object Undefined]'}
|
|
39
39
|
// =======================================================================
|
|
40
|
-
isEmpty
|
|
41
|
-
if(
|
|
40
|
+
function isEmpty( value ){
|
|
41
|
+
if(isStringetType(value)){ return value === ""; }
|
|
42
42
|
if(isArray(value) ){ return value.length == 0; }
|
|
43
43
|
if(isObject(value) ){ return Object.keys(value).length === 0;}
|
|
44
44
|
return true;
|
|
45
45
|
}
|
|
46
46
|
// =======================================================================
|
|
47
47
|
// Investigar Sobre los dominios de cada pais y de cada segmento comercial o publico personal
|
|
48
|
-
isEmail
|
|
48
|
+
function isEmail( value ){ 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( value )}
|
|
49
49
|
// =======================================================================
|
|
50
|
-
isNaN
|
|
50
|
+
function isNaN( value ){ return Number.isNaN( parseInt(value) )}
|
|
51
51
|
// =======================================================================
|
|
52
52
|
// ^(https?:\/\/)?([w]{3}\.|[w]{3}2\.)? protocol
|
|
53
53
|
// ([w]{3}\.|[w]{3}2\.)? ([a-z\d]+\.)?([a-z\d]+\.[a-z]{2,} Domain name www or www2
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
// (\:[\d]+)? -> port
|
|
57
57
|
// ([\??\/?]+[\/;&a-z\d%_.~+=-]*)? -> query url
|
|
58
58
|
// (\#[\/;&a-z\d%_.~+=-]*)? -> hashtag url
|
|
59
|
-
isUrl
|
|
59
|
+
function isUrl( value ){ 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(value)}
|
|
60
60
|
// =======================================================================
|
|
61
61
|
var base = function( func ){
|
|
62
62
|
// Retornamos una funcion
|
package/pp-is.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ppIs",t):(n=n||self).ppIs=t()}(this,(function(){function n(n){return Object.prototype.toString.call(n)}function t(t){return"[object Array]"===n(t)}function e(t){return"[object Function]"===n(t)}function i(t){return"[object Object]"===n(t)}var r=function(n){return function(t,i){return e(i)?n(t)?i(t):void 0:n(t)}};return{isArray:r(t),isBoolean:r((function(t){return!0===t||!1===t||"[object Boolean]"===n(t)})),isDate:r((function(t){return"[object Date]"===n(t)})),isElement:r((function(n){return!(!n||1!==n.nodeType)})),isEmpty:r((function(n){return isStringetType(n)?""===n:t(n)?0==n.length:!i(n)||0===Object.keys(n).length})),isFunction:r(e),isNull:r((function(t){return"[object Null]"===n(t)})),isNumber:r((function(t){return"[object Number]"===n(t)})),isObject:r(i),isString:r((function(t){return"[object String]"===n(t)})),isUndefined:r((function(t){return"[object Undefined]"===n(t)})),isEmail:r((function(n){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(n)})),isNaN:r((function(n){return Number.isNaN(parseInt(n))})),isRegExp:r((function(t){return"[object RegExp]"===n(t)})),isUrl:r((function(n){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(n)}))}}));
|