pp-is 1.2.3 → 1.2.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Carlos Enrique Illesca Monsalve
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.3/pp-is.min.js" ></script>
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
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.3/pp-is.min.js" ></script>
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
@@ -0,0 +1,13 @@
1
+ import baseEvaluate from "./baseEvaluate.js"
2
+ /**
3
+ * @function base
4
+ * @description - This function stretches to baseEvaluate passing as parameter the function that specifically evaluates the given value to be evaluated, but in the baseEvaluate function it arrives as a parameter called func
5
+ * @param {function} func - Evaluative function
6
+ * @return {function} - function to execute baseEvaluate
7
+ * @example
8
+ * const hello = "hello Word!";
9
+ * const evaluate = base(isString)(hello)
10
+ * //return true
11
+ */
12
+ const base = ( func ) => ( value ,done , reject) => baseEvaluate( func , value , done , reject)
13
+ export { base as default }
@@ -0,0 +1,16 @@
1
+ import isFunction from "./../main/isFunction.js"
2
+ import baseSanetize from "./baseSanetize.js"
3
+ /**
4
+ * @function baseEvaluate
5
+ * @description - Responsible for evaluation
6
+ * @param {function} func - Evaluative function
7
+ * @param {Any} value - The value to evaluate
8
+ * @param {function} done - Function to be executed in case the evaluation is positive.
9
+ * @param {function} reject - Function to be executed in case the evaluation is negative.
10
+ * @return {boolean} - value of the evaluation
11
+ */
12
+ const baseEvaluate = (func , value , done , reject) => {
13
+ const evaluate = func(value);
14
+ return evaluate ? isFunction( done ) ? baseSanetize(done,value,evaluate) : true : isFunction( reject ) ? baseSanetize(reject,value,evaluate) : false ;
15
+ }
16
+ export { baseEvaluate as default}
@@ -0,0 +1,14 @@
1
+ import isBoolean from "./../main/isBoolean.js"
2
+ /**
3
+ * @function baseSanetize
4
+ * @description - Trabajar Aqui
5
+ * @param { function } doneOrReject - Custom function that is triggered when the positive hook or negative hook is defined by the user. This function can resolve true or false independent of the first evaluation or it can simply do nothing.
6
+ * @param { Any } value - The value to evaluate
7
+ * @param { boolean } evaluate - pre evaulate from static function isString,isUndefined,..etc
8
+ * @return { boolean } - evaluate
9
+ */
10
+ const baseSanetize = ( doneOrReject , value , evaluate )=> {
11
+ const response = doneOrReject(value);
12
+ return isBoolean( response ) ? response : evaluate;
13
+ }
14
+ export { baseSanetize as default }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @function getType
3
+ * @description - Gets the type name
4
+ * @param {Any} value - Value to check
5
+ * @returns {string}
6
+ * @example
7
+ * const s = 'Hello Word';
8
+ * console.log(getType(s))
9
+ * // [object String]
10
+ */
11
+ const getType = (value)=>Object.prototype.toString.call(value)
12
+ export { getType as default }
@@ -0,0 +1,10 @@
1
+ import getType from "./getType.js"
2
+ /**
3
+ * @function getTypeCompare
4
+ * @description -
5
+ * @param {Any} value - Any Value
6
+ * @param {string} expression - Expression to compare
7
+ *
8
+ */
9
+ const getTypeCompare = (value,expression)=>(getType(value) === "[object "+expression+"]")
10
+ export { getTypeCompare as default }
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isArray
4
+ * @description - Checks if value is classified as an Array object.
5
+ * @param { Any } value - Any Value
6
+ * @return {boolean}
7
+ */
8
+ const isArray = (value)=> getTypeCompare(value,"Array")
9
+ export { isArray as default }
@@ -0,0 +1,10 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isBoolean
4
+ * @description - Checks if value is either true or false.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isBoolean=(value)=>value === true || value === false || getTypeCompare(value,'Boolean')
9
+ export { isBoolean as default }
10
+
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isDate
4
+ * @description - isDate
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isDate=(value)=>getTypeCompare(value,'Date')
9
+ export { isDate as default }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @function isElement
3
+ * @description - isElement
4
+ * @param { Any } value - Any value
5
+ * @return {boolean}
6
+ */
7
+ const isElement=(value)=>!!( value && value.nodeType === 1 )
8
+ export { isElement as default }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @function isEmail
3
+ * @description - Checks if value is a valid email.
4
+ * @param { Any } value - Any Value
5
+ * @example
6
+ * is.isEmail("h@blog.mydomian.xyz")
7
+ * // return true
8
+ * @return {boolean}
9
+ */
10
+ const isEmail = ( value )=>/^([a-z1-9\._-]+)@([a-z0-9-]+\.[a-z]{2,11}|[a-z0-9]+\.[a-z]{2,24}\.[a-z]{2,24})$/i.test( value )
11
+ export { isEmail as default }
@@ -0,0 +1,28 @@
1
+ import isString from "./isString.js"
2
+ import isArray from "./isArray.js"
3
+ import isObject from "./isObject.js"
4
+ /**
5
+ * @function isEmpty
6
+ * @description - Checks if value is not empty
7
+ * @param { Any } value - Any value
8
+ * @example
9
+ * // this a empty string
10
+ * is.isEmpty("")
11
+ * // return true
12
+ * @example
13
+ * // this a empty array
14
+ * is.isEmpty([])
15
+ * // return true
16
+ * @example
17
+ * // this a empty Object
18
+ * is.isEmpty({})
19
+ * // return true
20
+ * @return {boolean}
21
+ */
22
+ const isEmpty=(value)=>{
23
+ if(isString(value)){return value === ""}
24
+ else if(isArray(value)){return value.length == 0}
25
+ else if(isObject(value)){return Object.keys(value).length === 0}
26
+ return true;
27
+ }
28
+ export { isEmpty as default }
@@ -0,0 +1,10 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isFunction
4
+ * @description - Checks if value is a Function.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isFunction=(value) =>getTypeCompare(value,'Function')
9
+ export { isFunction as default }
10
+
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @function isHTMLCollection
3
+ * @description - Checks if value is a valid HTMLCollection.
4
+ * @param { Any } value - Any Value
5
+ * @return {boolean}
6
+ */
7
+ const isHTMLCollection=(value)=>(typeof HTMLCollection === "undefined" ? false : HTMLCollection.prototype.isPrototypeOf(value))
8
+ export { isHTMLCollection as default }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @function isNaN
3
+ * @description - Checks if value is a valid Number from String.
4
+ * @param { Any } value - Any Value
5
+ * @return {boolean}
6
+ */
7
+ const isNaN = ( value )=>(Number.isNaN( Number.parseInt(value)))
8
+ export { isNaN as default }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @function isNodeList
3
+ * @description - Checks if value is a valid NodeList.
4
+ * @param { Any } value - Any Value
5
+ * @return {boolean}
6
+ */
7
+ const isNodeList=(value)=>(typeof NodeList === "undefined" ? false : NodeList.prototype.isPrototypeOf(value))
8
+ export { isNodeList as default}
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isNull
4
+ * @description - Checks if value is a Null.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isNull=(value)=>getTypeCompare(value,'Null')
9
+ export { isNull as default }
@@ -0,0 +1,11 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ import isNaN from "./isNaN.js"
3
+ /**
4
+ * @function isNumber
5
+ * @description - Checks if value is a Number.
6
+ * @param { Any } value - Any value
7
+ * @return {boolean}
8
+ */
9
+ const isNumber=(value)=>getTypeCompare(value,'Number') && !isNaN(value)
10
+ export { isNumber as default }
11
+
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isObject
4
+ * @description - Checks if value is classified as an Object.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isObject=(value)=>getTypeCompare(value,'Object')
9
+ export { isObject as default }
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isRegExp
4
+ * @description - Checks if value is a RegExp.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isRegExp = (value)=> getTypeCompare(value,"RegExp")
9
+ export { isRegExp as default }
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isString
4
+ * @description - Checks if value is a string.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isString = (value)=> getTypeCompare(value,"String")
9
+ export { isString as default }
@@ -0,0 +1,9 @@
1
+ import getTypeCompare from "./../helper/getTypeCompare.js"
2
+ /**
3
+ * @function isUndefined
4
+ * @description - Checks if value is a undefined.
5
+ * @param { Any } value - Any value
6
+ * @return {boolean}
7
+ */
8
+ const isUndefined=(value)=>getTypeCompare(value,'Undefined')
9
+ export { isUndefined as default }
@@ -0,0 +1,17 @@
1
+ // =======================================================================
2
+ // ^(https?:\/\/)?([w]{3}\.|[w]{3}2\.)? protocol
3
+ // ([w]{3}\.|[w]{3}2\.)? ([a-z\d]+\.)?([a-z\d]+\.[a-z]{2,} Domain name www or www2
4
+ // localhost -> include this word
5
+ // [\d]+\.[\d]+\.[\d]+\.[\d]+ -> add ipv4
6
+ // (\:[\d]+)? -> port
7
+ // ([\??\/?]+[\/;&a-z\d%_.~+=-]*)? -> query url
8
+ // (\#[\/;&a-z\d%_.~+=-]*)? -> hashtag url
9
+ /**
10
+ * @function isUrl
11
+ * @description - Checks if value is a valid Url.
12
+ * @param { Any } value - Any Value
13
+ * @return {boolean}
14
+ */
15
+
16
+ const isUrl = ( value )=>/^(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)
17
+ export { isUrl as default}
package/dist/pp-is.js CHANGED
@@ -1,293 +1,52 @@
1
1
  /*!!
2
2
  * Power Panel pp-is <https://github.com/carlos-sweb/pp-is>
3
3
  * @author Carlos Illesca
4
- * @version 1.2.3 (2024/10/06 23:58 PM)
4
+ * @version 1.2.5 (2025/06/01 21:58 PM)
5
5
  * Released under the MIT License
6
+ */
7
+ import isString from "./main/isString.js"
8
+ import isArray from "./main/isArray.js"
9
+ import isObject from "./main/isObject.js"
10
+ import isRegExp from "./main/isRegExp.js"
11
+ import isBoolean from "./main/isBoolean.js"
12
+ import isDate from "./main/isDate.js"
13
+ import isFunction from "./main/isFunction.js"
14
+ import isUndefined from "./main/isUndefined.js"
15
+ import isNull from "./main/isNull.js"
16
+ import isNaN from "./main/isNaN.js"
17
+ import isNumber from "./main/isNumber.js"
18
+ import isEmail from "./main/isEmail.js"
19
+ import isUrl from "./main/isUrl.js"
20
+ import isEmpty from "./main/isEmpty.js"
21
+ import isNodeList from "./main/isNodeList.js"
22
+ import isElement from "./main/isElement.js"
23
+ import isHTMLCollection from "./main/isHTMLCollection.js"
24
+ import base from "./helper/base.js"
25
+ /**
26
+ * @description - Obtains the object to be exported with the following main functions
27
+ * @name is
28
+ * @type {object}
29
+ * @property {function} isArray - {@link isArray}
30
+ * @property {function} isBoolean - {@link isBoolean}
31
+ * @property {function} isDate - {@link isDate}
32
+ * @property {function} isElement - {@link isElement}
33
+ * @property {function} isEmpty - {@link isEmpty}
34
+ * @property {function} isFunction - {@link isFunction}
35
+ * @property {function} isNull - {@link isNull}
36
+ * @property {function} isNumber - {@link isNumber}
37
+ * @property {function} isString - {@link isString}
38
+ * @property {function} isUndefined - {@link isUndefined}
39
+ * @property {function} isEmail - {@link isEmail}
40
+ * @property {function} isNaN - {@link isNaN}
41
+ * @property {function} isRegExp - {@link isRegExp}
42
+ * @property {function} isUrl - {@link isUrl}
43
+ * @property {function} isNodeList - {@link isNodeList}
44
+ * @property {function} isHTMLCollection - {@link isHTMLCollection}
45
+ * @property {function} isAMD - {@link isAMD}
46
+ * @property {function} isFreeModule - {@link isFreeModule}
47
+ * @property {function} getRoot - {@link getRoot}
6
48
  */
7
- ;(function(){
8
- "use strict";
9
- /**
10
- * @function getType
11
- * @description - Gets the type name
12
- * @param {Any} value - Value to check
13
- * @returns {string}
14
- * @example
15
- * const s = 'Hello Word';
16
- * console.log(getType(s))
17
- * // [object String]
18
- */
19
- const getType=(value)=>Object.prototype.toString.call(value),
20
- /**
21
- * @description - This function checks for the presence of `define` in the global scope and checks if it is configured as an AMD module.
22
- * @function getAMD
23
- * @return {object} - define object if exists
24
- */
25
- getAMD = ()=>typeof define == 'function' && typeof define.amd == 'object' && define.amd,
26
- /**
27
- * @function isAMD
28
- * @description - check if AMD is a Object
29
- * @return {boolean} - AMD works
30
- */
31
- isAMD=()=>isObject(getAMD()),
32
- /**
33
- * @function getFreeGlobal
34
- * @descriptcion - Detect free variable `global`
35
- * @return {object}
36
- */
37
- getFreeGlobal=()=>(typeof global == 'object' && global && global.Object === Object && global),
38
- /**
39
- * @function getFreeGlobal
40
- * @descriptcion - Detect free variable `self`
41
- * @return {object}
42
- */
43
- getFreeSelf=()=>(typeof self == 'object' && self && self.Object === Object && self),
44
- /**
45
- * @name getRoot
46
- * @description - Used as a reference to the global object.
47
- * @function
48
- * @return {object}
49
- */
50
- getRoot=()=>{
51
- return getFreeGlobal() || getFreeSelf() || Function('return this')();
52
- },
53
- /**
54
- * @function isFreeExports
55
- * @description - Detect free variable `exports`
56
- * @return {boolean} -
57
- */
58
- isFreeExports =()=>(typeof exports == 'object' && exports && !exports.nodeType && exports),
59
- /**
60
- * @function getFreeModule
61
- * @description - Detect free variable `module`.
62
- * @return {object} - variable `module`
63
- */
64
- getFreeModule=()=>(isFreeExports() && typeof module == 'object' && module && !module.nodeType && module),
65
-
66
- /**
67
- * @function isFreeModule
68
- * @description - detect if variable module is Object
69
- * @param { Any } value - Any value
70
- * @return {boolean}
71
- */
72
- isFreeModule=()=>isObject(getFreeModule()),
73
- /**
74
- * @function getTypeCompare
75
- * @description -
76
- * @param {Any} value - Any Value
77
- * @param {string} expression - Expression to compare
78
- *
79
- */
80
- getTypeCompare=(value,expression)=>(getType(value) === "[object "+expression+"]"),
81
- /**
82
- * @function isNodeList
83
- * @description - Checks if value is a valid NodeList.
84
- * @param { Any } value - Any Value
85
- * @return {boolean}
86
- */
87
- isNodeList=(value)=>(typeof NodeList === "undefined" ? false : NodeList.prototype.isPrototypeOf(value)),
88
- /**
89
- * @function isHTMLCollection
90
- * @description - Checks if value is a valid HTMLCollection.
91
- * @param { Any } value - Any Value
92
- * @return {boolean}
93
- */
94
- isHTMLCollection=(value)=>(typeof HTMLCollection === "undefined" ? false : HTMLCollection.prototype.isPrototypeOf(value)),
95
- /**
96
- * @function isArray
97
- * @description - Checks if value is classified as an Array object.
98
- * @param { Any } value - Any Value
99
- * @return {boolean}
100
- */
101
- isArray=(value)=>getTypeCompare(value,'Array'),
102
- /**
103
- * @function isRegExp
104
- * @description - Checks if value is a RegExp.
105
- * @param { Any } value - Any value
106
- * @return {boolean}
107
- */
108
- isRegExp=(value)=>getTypeCompare(value,'RegExp'),
109
- /**
110
- * @function isBoolean
111
- * @description - Checks if value is either true or false.
112
- * @param { Any } value - Any value
113
- * @return {boolean}
114
- */
115
- isBoolean=(value)=>value === true || value === false || getTypeCompare(value,'Boolean'),
116
- /**
117
- * @function isDate
118
- * @description - isDate
119
- * @param { Any } value - Any value
120
- * @return {boolean}
121
- */
122
- isDate=(value)=>getTypeCompare(value,'Date'),
123
- /**
124
- * @function isElement
125
- * @description - isElement
126
- * @param { Any } value - Any value
127
- * @return {boolean}
128
- */
129
- isElement=(value)=>!!( value && value.nodeType === 1 ) ,
130
- /**
131
- * @function isFunction
132
- * @description - Checks if value is a Function.
133
- * @param { Any } value - Any value
134
- * @return {boolean}
135
- */
136
- isFunction=(value) =>getTypeCompare(value,'Function'),
137
- /**
138
- * @function isNull
139
- * @description - Checks if value is a Null.
140
- * @param { Any } value - Any value
141
- * @return {boolean}
142
- */
143
- isNull=(value)=>getTypeCompare(value,'Null'),
144
- /**
145
- * @function isNumber
146
- * @description - Checks if value is a Number.
147
- * @param { Any } value - Any value
148
- * @return {boolean}
149
- */
150
- isNumber=(value)=>getTypeCompare(value,'Number'),
151
- /**
152
- * @function isObject
153
- * @description - Checks if value is classified as an Object.
154
- * @param { Any } value - Any value
155
- * @return {boolean}
156
- */
157
- isObject=(value)=>getTypeCompare(value,'Object'),
158
- /**
159
- * @function isString
160
- * @description - Checks if value is a string.
161
- * @param { Any } value - Any value
162
- * @return {boolean}
163
- */
164
- isString=(value)=>getTypeCompare(value,'String'),
165
- /**
166
- * @function isUndefined
167
- * @description - Checks if value is a undefined.
168
- * @param { Any } value - Any value
169
- * @return {boolean}
170
- */
171
- isUndefined=(value)=>getTypeCompare(value,'Undefined'),
172
- /**
173
- * @function isEmpty
174
- * @description - Checks if value is not empty
175
- * @param { Any } value - Any value
176
- * @example
177
- * // this a empty string
178
- * is.isEmpty("")
179
- * // return true
180
- * @example
181
- * // this a empty array
182
- * is.isEmpty([])
183
- * // return true
184
- * @example
185
- * // this a empty Object
186
- * is.isEmpty({})
187
- * // return true
188
- * @return {boolean}
189
- */
190
- isEmpty=(value)=>{
191
- if(isString(value)){return value === ""}
192
- else if(isArray(value)){return value.length == 0}
193
- else if(isObject(value)){return Object.keys(value).length === 0}
194
- return true;
195
- },
196
- /**
197
- * @function isEmail
198
- * @description - Checks if value is a valid email.
199
- * @param { Any } value - Any Value
200
- * @example
201
- * is.isEmail("h@blog.mydomian.xyz")
202
- * // return true
203
- * @return {boolean}
204
- */
205
- isEmail = ( value )=>/^([a-z1-9\._-]+)@([a-z0-9-]+\.[a-z]{2,11}|[a-z0-9]+\.[a-z]{2,24}\.[a-z]{2,24})$/i.test( value ),
206
- /**
207
- * @function isNaN
208
- * @description - Checks if value is a valid Number from String.
209
- * @param { Any } value - Any Value
210
- * @return {boolean}
211
- */
212
- isNaN = ( value )=>(Number.isNaN( parseInt(value))),
213
- // =======================================================================
214
- // ^(https?:\/\/)?([w]{3}\.|[w]{3}2\.)? protocol
215
- // ([w]{3}\.|[w]{3}2\.)? ([a-z\d]+\.)?([a-z\d]+\.[a-z]{2,} Domain name www or www2
216
- // localhost -> include this word
217
- // [\d]+\.[\d]+\.[\d]+\.[\d]+ -> add ipv4
218
- // (\:[\d]+)? -> port
219
- // ([\??\/?]+[\/;&a-z\d%_.~+=-]*)? -> query url
220
- // (\#[\/;&a-z\d%_.~+=-]*)? -> hashtag url
221
- /**
222
- * @function isUrl
223
- * @description - Checks if value is a valid Url.
224
- * @param { Any } value - Any Value
225
- * @return {boolean}
226
- */
227
- isUrl = ( value )=>/^(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),
228
-
229
- // =======================================================================
230
- /**
231
- * @function baseSanetize
232
- * @description - Trabajar Aqui
233
- * @param { function } doneOrReject - Custom function that is triggered when the positive hook or negative hook is defined by the user. This function can resolve true or false independent of the first evaluation or it can simply do nothing.
234
- * @param { Any } value - The value to evaluate
235
- * @param { boolean } evaluate - pre evaulate from static function isString,isUndefined,..etc
236
- * @return { boolean } - evaluate
237
- */
238
- baseSanetize = ( doneOrReject , value , evaluate )=> {
239
- const response = doneOrReject(value);
240
- return isBoolean( response ) ? response : evaluate;
241
- },
242
- /**
243
- * @function baseEvaluate
244
- * @description - Responsible for evaluation
245
- * @param {function} func - Evaluative function
246
- * @param {Any} value - The value to evaluate
247
- * @param {function} done - Function to be executed in case the evaluation is positive.
248
- * @param {function} reject - Function to be executed in case the evaluation is negative.
249
- * @return {boolean} - value of the evaluation
250
- */
251
- baseEvaluate = (func , value , done , reject) => {
252
- const evaluate = func(value);
253
- return evaluate ? isFunction( done ) ? baseSanetize(done,value,evaluate) : true : isFunction( reject ) ? baseSanetize(reject,value,evaluate) : false ;
254
- },
255
- /**
256
- * @function base
257
- * @description - This function stretches to baseEvaluate passing as parameter the function that specifically evaluates the given value to be evaluated, but in the baseEvaluate function it arrives as a parameter called func
258
- * @param {function} func - Evaluative function
259
- * @return {function} - function to execute baseEvaluate
260
- * @example
261
- * const hello = "hello Word!";
262
- * const evaluate = base(isString)(hello)
263
- * //return true
264
- */
265
- base = ( func ) => ( value ,done , reject) => baseEvaluate( func , value , done , reject),
266
- /**
267
- * @description - Obtains the object to be exported with the following main functions
268
- * @name is
269
- * @type {object}
270
- * @property {function} isArray - {@link isArray}
271
- * @property {function} isBoolean - {@link isBoolean}
272
- * @property {function} isDate - {@link isDate}
273
- * @property {function} isElement - {@link isElement}
274
- * @property {function} isEmpty - {@link isEmpty}
275
- * @property {function} isFunction - {@link isFunction}
276
- * @property {function} isNull - {@link isNull}
277
- * @property {function} isNumber - {@link isNumber}
278
- * @property {function} isString - {@link isString}
279
- * @property {function} isUndefined - {@link isUndefined}
280
- * @property {function} isEmail - {@link isEmail}
281
- * @property {function} isNaN - {@link isNaN}
282
- * @property {function} isRegExp - {@link isRegExp}
283
- * @property {function} isUrl - {@link isUrl}
284
- * @property {function} isNodeList - {@link isNodeList}
285
- * @property {function} isHTMLCollection - {@link isHTMLCollection}
286
- * @property {function} isAMD - {@link isAMD}
287
- * @property {function} isFreeModule - {@link isFreeModule}
288
- * @property {function} getRoot - {@link getRoot}
289
- */
290
- is = {
49
+ const is = {
291
50
  'isArray':base(isArray),
292
51
  'isBoolean':base(isBoolean),
293
52
  'isDate':base(isDate),
@@ -304,18 +63,7 @@
304
63
  'isRegExp':base(isRegExp),
305
64
  'isUrl':base(isUrl),
306
65
  'isNodeList':base(isNodeList),
307
- 'isHTMLCollection':base(isHTMLCollection),
308
- 'isAMD':base(isAMD),
309
- 'isFreeModule':base(isFreeModule),
310
- 'getRoot':getRoot
66
+ 'isHTMLCollection':base(isHTMLCollection),
311
67
  }
312
68
 
313
-
314
- //
315
- is.isAMD(null,()=>{define(()=>is)},()=>{
316
- is.isFreeModule(null,()=>{ module.exports = is; },()=>{
317
- is.getRoot().ppIs = is
318
- })
319
- });
320
-
321
- }.call(this))
69
+ export { is as default }
package/dist/pp-is.min.js CHANGED
@@ -1 +1 @@
1
- (function(){"use strict";const e=()=>"object"==typeof exports&&exports&&!exports.nodeType&&exports&&"object"==typeof module&&module&&!module.nodeType&&module,t=(e,t)=>(e=>Object.prototype.toString.call(e))(e)==="[object "+t+"]",o=e=>t(e,"Array"),i=e=>!0===e||!1===e||t(e,"Boolean"),s=e=>t(e,"Function"),l=e=>t(e,"Object"),n=e=>t(e,"String"),d=(e,t,o)=>{const s=e(t);return i(s)?s:o},p=e=>(t,o,i)=>((e,t,o,i)=>{const l=e(t);return l?!s(o)||d(o,t,l):!!s(i)&&d(i,t,l)})(e,t,o,i),r={isArray:p(o),isBoolean:p(i),isDate:p((e=>t(e,"Date"))),isElement:p((e=>!(!e||1!==e.nodeType))),isEmpty:p((e=>n(e)?""===e:o(e)?0==e.length:!l(e)||0===Object.keys(e).length)),isFunction:p(s),isNull:p((e=>t(e,"Null"))),isNumber:p((e=>t(e,"Number"))),isObject:p(l),isString:p(n),isUndefined:p((e=>t(e,"Undefined"))),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((e=>Number.isNaN(parseInt(e)))),isRegExp:p((e=>t(e,"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))),isAMD:p((()=>l("function"==typeof define&&"object"==typeof define.amd&&define.amd))),isFreeModule:p((()=>l(e()))),getRoot:()=>"object"==typeof global&&global&&global.Object===Object&&global||"object"==typeof self&&self&&self.Object===Object&&self||Function("return this")()};r.isAMD(null,(()=>{define((()=>r))}),(()=>{r.isFreeModule(null,(()=>{module.exports=r}),(()=>{r.getRoot().ppIs=r}))}))}).call(this);
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)),l=(e,t,i)=>{const o=e(t);return n(o)?o:i},r=e=>(t,i,o)=>((e,t,i,o)=>{const n=e(t);return n?!s(i)||l(i,t,n):!!s(o)&&l(o,t,n)})(e,t,i,o);return{isArray:r(i),isBoolean:r(n),isDate:r((t=>e(t,"Date"))),isElement:r((e=>!(!e||1!==e.nodeType))),isEmpty:r((e=>t(e)?""===e:i(e)?0==e.length:!o(e)||0===Object.keys(e).length)),isFunction:r(s),isNull:r((t=>e(t,"Null"))),isNumber:r((t=>e(t,"Number")&&!d(t))),isObject:r(o),isString:r(t),isUndefined:r((t=>e(t,"Undefined"))),isEmail:r((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:r(d),isRegExp:r((t=>e(t,"RegExp"))),isUrl:r((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:r((e=>"undefined"!=typeof NodeList&&NodeList.prototype.isPrototypeOf(e))),isHTMLCollection:r((e=>"undefined"!=typeof HTMLCollection&&HTMLCollection.prototype.isPrototypeOf(e)))}}));
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "pp-is",
3
3
  "description": "Collection of methods for check",
4
- "version": "1.2.3",
4
+ "version": "1.2.5",
5
5
  "main": "dist/pp-is.min.js",
6
- "scripts" :{
7
- "djs":"documentation build ./dist/pp-is.js -f html -o ./djs && php -S localhost:8091 -t ./djs",
8
- "docs" : "jsdoc ./dist/pp-is.js -d docs && php -S localhost:8091 -t ./docs",
9
- "serve-webpack" : "cp dist/pp-is.js ./test/js/ && webpack --config ./test/config/webpack.config.js && php -S localhost:8090 -t ./test",
10
- "compile" : "terser --output dist/pp-is.min.js --compress --mangle --comments false -- dist/pp-is.js"
6
+ "scripts": {
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",
8
+ "djs": "documentation build ./dist/pp-is.js -f html -o ./djs && php -S localhost:8091 -t ./djs",
9
+ "docs": "jsdoc ./dist/pp-is.js -d docs && php -S localhost:8091 -t ./docs",
10
+ "serve-webpack": "cp dist/pp-is.js ./test/js/ && webpack --config ./test/config/webpack.config.js && php -S localhost:8090 -t ./test",
11
+ "compile": "terser --output dist/pp-is.min.js --compress --mangle --comments false -- dist/pp-is.js"
11
12
  },
12
13
  "repository": {
13
14
  "type": "git",
@@ -0,0 +1,9 @@
1
+ export default {
2
+ input: "./dist/pp-is.js",
3
+ output: {
4
+ name : "ppIs",
5
+ compact:false,
6
+ file: "./dist/pp-is.rollup.js",
7
+ format: "umd"
8
+ }
9
+ };
@@ -1,13 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- mode: 'production',
5
- entry: [
6
- path.resolve(__dirname,'..','js','main.webpack.js')
7
- ],
8
- output: {
9
- path: path.resolve(__dirname, '..' ,'dist'),
10
- filename: 'pp-is.app.bundle.js',
11
- },
12
- };
13
-
@@ -1,2 +0,0 @@
1
- /*! For license information please see pp-is.app.bundle.js.LICENSE.txt */
2
- (()=>{var e={343:function(e,t,o){var i;e=o.nmd(e),function(){"use strict";const n=(e,t)=>(e=>Object.prototype.toString.call(e))(e)==="[object "+t+"]",s=e=>n(e,"Array"),r=e=>!0===e||!1===e||n(e,"Boolean"),l=e=>n(e,"Function"),a=e=>n(e,"Object"),c=e=>n(e,"String"),d=(e,t,o)=>{const i=e(t);return r(i)?i:o},u=e=>(t,o,i)=>((e,t,o,i)=>{const n=e(t);return n?!l(o)||d(o,t,n):!!l(i)&&d(i,t,n)})(e,t,o,i),p={isArray:u(s),isBoolean:u(r),isDate:u((e=>n(e,"Date"))),isElement:u((e=>!(!e||1!==e.nodeType))),isEmpty:u((e=>c(e)?""===e:s(e)?0==e.length:!a(e)||0===Object.keys(e).length)),isFunction:u(l),isNull:u((e=>n(e,"Null"))),isNumber:u((e=>n(e,"Number"))),isObject:u(a),isString:u(c),isUndefined:u((e=>n(e,"Undefined"))),isEmail:u((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:u((e=>Number.isNaN(parseInt(e)))),isRegExp:u((e=>n(e,"RegExp"))),isUrl:u((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:u((e=>"undefined"!=typeof NodeList&&NodeList.prototype.isPrototypeOf(e))),isHTMLCollection:u((e=>"undefined"!=typeof HTMLCollection&&HTMLCollection.prototype.isPrototypeOf(e))),isAMD:u((()=>a(o.amdO))),isFreeModule:u((()=>a(t&&!t.nodeType&&t&&e&&!e.nodeType&&e))),getRoot:()=>"object"==typeof o.g&&o.g&&o.g.Object===Object&&o.g||"object"==typeof self&&self&&self.Object===Object&&self||Function("return this")()};p.isAMD(null,(()=>{void 0===(i=(()=>p).call(t,o,t,e))||(e.exports=i)}),(()=>{p.isFreeModule(null,(()=>{e.exports=p}),(()=>{p.getRoot().ppIs=p}))}))}.call(this)}},t={};function o(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={id:i,loaded:!1,exports:{}};return e[i].call(s.exports,s,s.exports,o),s.loaded=!0,s.exports}o.amdO={},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e=o(343),t=o.n(e);console.log("Testing....."),console.log("Check 100:",t().isNumber(100)),t().isNumber(100,(()=>{console.log("Esto es numero Felicitaciones")}))})()})();
@@ -1,6 +0,0 @@
1
- /*!!
2
- * Power Panel pp-is <https://github.com/carlos-sweb/pp-is>
3
- * @author Carlos Illesca
4
- * @version 1.2.3 (2024/09/18 15:14 PM)
5
- * Released under the MIT License
6
- */
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>pp-is.js - webpack</title>
7
- <!--<script data-main="main" src="https://requirejs.org/docs/release/2.3.7/minified/require.js"></script>-->
8
- </head>
9
- <body>
10
-
11
- <script type="text/javascript" src="dist/pp-is.app.bundle.js"></script>
12
- </body>
13
- </html>
@@ -1,12 +0,0 @@
1
- requirejs.config({
2
- baseUrl:'',
3
- paths: {
4
- 'pp-is': 'dist/pp-is',
5
- }
6
- });
7
-
8
- // Start the main app logic.
9
- requirejs([ 'pp-is' ], function( ppIs ) {
10
-
11
-
12
- });
@@ -1 +0,0 @@
1
- import is from './pp-is.js'
package/test/js/pp-is.js DELETED
@@ -1,321 +0,0 @@
1
- /*!!
2
- * Power Panel pp-is <https://github.com/carlos-sweb/pp-is>
3
- * @author Carlos Illesca
4
- * @version 1.2.3 (2024/10/06 23:25 PM)
5
- * Released under the MIT License
6
- */
7
- ;(function(){
8
- "use strict";
9
- /**
10
- * @function getType
11
- * @description - Gets the type name
12
- * @param {Any} value - Value to check
13
- * @returns {string}
14
- * @example
15
- * const s = 'Hello Word';
16
- * console.log(getType(s))
17
- * // [object String]
18
- */
19
- const getType=(value)=>Object.prototype.toString.call(value),
20
- /**
21
- * @description - This function checks for the presence of `define` in the global scope and checks if it is configured as an AMD module.
22
- * @function getAMD
23
- * @return {object} - define object if exists
24
- */
25
- getAMD = ()=>typeof define == 'function' && typeof define.amd == 'object' && define.amd,
26
- /**
27
- * @function isAMD
28
- * @description - check if AMD is a Object
29
- * @return {boolean} - AMD works
30
- */
31
- isAMD=()=>isObject(getAMD()),
32
- /**
33
- * @function getFreeGlobal
34
- * @descriptcion - Detect free variable `global`
35
- * @return {object}
36
- */
37
- getFreeGlobal=()=>(typeof global == 'object' && global && global.Object === Object && global),
38
- /**
39
- * @function getFreeGlobal
40
- * @descriptcion - Detect free variable `self`
41
- * @return {object}
42
- */
43
- getFreeSelf=()=>(typeof self == 'object' && self && self.Object === Object && self),
44
- /**
45
- * @name getRoot
46
- * @description - Used as a reference to the global object.
47
- * @function
48
- * @return {object}
49
- */
50
- getRoot=()=>{
51
- return getFreeGlobal() || getFreeSelf() || Function('return this')();
52
- },
53
- /**
54
- * @function isFreeExports
55
- * @description - Detect free variable `exports`
56
- * @return {boolean} -
57
- */
58
- isFreeExports =()=>(typeof exports == 'object' && exports && !exports.nodeType && exports),
59
- /**
60
- * @function getFreeModule
61
- * @description - Detect free variable `module`.
62
- * @return {object} - variable `module`
63
- */
64
- getFreeModule=()=>(isFreeExports() && typeof module == 'object' && module && !module.nodeType && module),
65
-
66
- /**
67
- * @function isFreeModule
68
- * @description - detect if variable module is Object
69
- * @param { Any } value - Any value
70
- * @return {boolean}
71
- */
72
- isFreeModule=()=>isObject(getFreeModule()),
73
- /**
74
- * @function getTypeCompare
75
- * @description -
76
- * @param {Any} value - Any Value
77
- * @param {string} expression - Expression to compare
78
- *
79
- */
80
- getTypeCompare=(value,expression)=>(getType(value) === "[object "+expression+"]"),
81
- /**
82
- * @function isNodeList
83
- * @description - Checks if value is a valid NodeList.
84
- * @param { Any } value - Any Value
85
- * @return {boolean}
86
- */
87
- isNodeList=(value)=>(typeof NodeList === "undefined" ? false : NodeList.prototype.isPrototypeOf(value)),
88
- /**
89
- * @function isHTMLCollection
90
- * @description - Checks if value is a valid HTMLCollection.
91
- * @param { Any } value - Any Value
92
- * @return {boolean}
93
- */
94
- isHTMLCollection=(value)=>(typeof HTMLCollection === "undefined" ? false : HTMLCollection.prototype.isPrototypeOf(value)),
95
- /**
96
- * @function isArray
97
- * @description - Checks if value is classified as an Array object.
98
- * @param { Any } value - Any Value
99
- * @return {boolean}
100
- */
101
- isArray=(value)=>getTypeCompare(value,'Array'),
102
- /**
103
- * @function isRegExp
104
- * @description - Checks if value is a RegExp.
105
- * @param { Any } value - Any value
106
- * @return {boolean}
107
- */
108
- isRegExp=(value)=>getTypeCompare(value,'RegExp'),
109
- /**
110
- * @function isBoolean
111
- * @description - Checks if value is either true or false.
112
- * @param { Any } value - Any value
113
- * @return {boolean}
114
- */
115
- isBoolean=(value)=>value === true || value === false || getTypeCompare(value,'Boolean'),
116
- /**
117
- * @function isDate
118
- * @description - isDate
119
- * @param { Any } value - Any value
120
- * @return {boolean}
121
- */
122
- isDate=(value)=>getTypeCompare(value,'Date'),
123
- /**
124
- * @function isElement
125
- * @description - isElement
126
- * @param { Any } value - Any value
127
- * @return {boolean}
128
- */
129
- isElement=(value)=>!!( value && value.nodeType === 1 ) ,
130
- /**
131
- * @function isFunction
132
- * @description - Checks if value is a Function.
133
- * @param { Any } value - Any value
134
- * @return {boolean}
135
- */
136
- isFunction=(value) =>getTypeCompare(value,'Function'),
137
- /**
138
- * @function isNull
139
- * @description - Checks if value is a Null.
140
- * @param { Any } value - Any value
141
- * @return {boolean}
142
- */
143
- isNull=(value)=>getTypeCompare(value,'Null'),
144
- /**
145
- * @function isNumber
146
- * @description - Checks if value is a Number.
147
- * @param { Any } value - Any value
148
- * @return {boolean}
149
- */
150
- isNumber=(value)=>getTypeCompare(value,'Number'),
151
- /**
152
- * @function isObject
153
- * @description - Checks if value is classified as an Object.
154
- * @param { Any } value - Any value
155
- * @return {boolean}
156
- */
157
- isObject=(value)=>getTypeCompare(value,'Object'),
158
- /**
159
- * @function isString
160
- * @description - Checks if value is a string.
161
- * @param { Any } value - Any value
162
- * @return {boolean}
163
- */
164
- isString=(value)=>getTypeCompare(value,'String'),
165
- /**
166
- * @function isUndefined
167
- * @description - Checks if value is a undefined.
168
- * @param { Any } value - Any value
169
- * @return {boolean}
170
- */
171
- isUndefined=(value)=>getTypeCompare(value,'Undefined'),
172
- /**
173
- * @function isEmpty
174
- * @description - Checks if value is not empty
175
- * @param { Any } value - Any value
176
- * @example
177
- * // this a empty string
178
- * is.isEmpty("")
179
- * // return true
180
- * @example
181
- * // this a empty array
182
- * is.isEmpty([])
183
- * // return true
184
- * @example
185
- * // this a empty Object
186
- * is.isEmpty({})
187
- * // return true
188
- * @return {boolean}
189
- */
190
- isEmpty=(value)=>{
191
- if(isString(value)){return value === ""}
192
- else if(isArray(value)){return value.length == 0}
193
- else if(isObject(value)){return Object.keys(value).length === 0}
194
- return true;
195
- },
196
- /**
197
- * @function isEmail
198
- * @description - Checks if value is a valid email.
199
- * @param { Any } value - Any Value
200
- * @example
201
- * is.isEmail("h@blog.mydomian.xyz")
202
- * // return true
203
- * @return {boolean}
204
- */
205
- isEmail = ( value )=>/^([a-z1-9\._-]+)@([a-z0-9-]+\.[a-z]{2,11}|[a-z0-9]+\.[a-z]{2,24}\.[a-z]{2,24})$/i.test( value ),
206
- /**
207
- * @function isNaN
208
- * @description - Checks if value is a valid Number from String.
209
- * @param { Any } value - Any Value
210
- * @return {boolean}
211
- */
212
- isNaN = ( value )=>(Number.isNaN( parseInt(value))),
213
- // =======================================================================
214
- // ^(https?:\/\/)?([w]{3}\.|[w]{3}2\.)? protocol
215
- // ([w]{3}\.|[w]{3}2\.)? ([a-z\d]+\.)?([a-z\d]+\.[a-z]{2,} Domain name www or www2
216
- // localhost -> include this word
217
- // [\d]+\.[\d]+\.[\d]+\.[\d]+ -> add ipv4
218
- // (\:[\d]+)? -> port
219
- // ([\??\/?]+[\/;&a-z\d%_.~+=-]*)? -> query url
220
- // (\#[\/;&a-z\d%_.~+=-]*)? -> hashtag url
221
- /**
222
- * @function isUrl
223
- * @description - Checks if value is a valid Url.
224
- * @param { Any } value - Any Value
225
- * @return {boolean}
226
- */
227
- isUrl = ( value )=>/^(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),
228
-
229
- // =======================================================================
230
- /**
231
- * @function baseSanetize
232
- * @description - Trabajar Aqui
233
- * @param { function } doneOrReject - Custom function that is triggered when the positive hook or negative hook is defined by the user. This function can resolve true or false independent of the first evaluation or it can simply do nothing.
234
- * @param { Any } value - The value to evaluate
235
- * @param { boolean } evaluate - pre evaulate from static function isString,isUndefined,..etc
236
- * @return { boolean } - evaluate
237
- */
238
- baseSanetize = ( doneOrReject , value , evaluate )=> {
239
- const response = doneOrReject(value);
240
- return isBoolean( response ) ? response : evaluate;
241
- },
242
- /**
243
- * @function baseEvaluate
244
- * @description - Responsible for evaluation
245
- * @param {function} func - Evaluative function
246
- * @param {Any} value - The value to evaluate
247
- * @param {function} done - Function to be executed in case the evaluation is positive.
248
- * @param {function} reject - Function to be executed in case the evaluation is negative.
249
- * @return {boolean} - value of the evaluation
250
- */
251
- baseEvaluate = (func , value , done , reject) => {
252
- const evaluate = func(value);
253
- return evaluate ? isFunction( done ) ? baseSanetize(done,value,evaluate) : true : isFunction( reject ) ? baseSanetize(reject,value,evaluate) : false ;
254
- },
255
- /**
256
- * @function base
257
- * @description - This function stretches to baseEvaluate passing as parameter the function that specifically evaluates the given value to be evaluated, but in the baseEvaluate function it arrives as a parameter called func
258
- * @param {function} func - Evaluative function
259
- * @return {function} - function to execute baseEvaluate
260
- * @example
261
- * const hello = "hello Word!";
262
- * const evaluate = base(isString)(hello)
263
- * //return true
264
- */
265
- base = ( func ) => ( value ,done , reject) => baseEvaluate( func , value , done , reject),
266
- /**
267
- * @description - Obtains the object to be exported with the following main functions
268
- * @name is
269
- * @type {object}
270
- * @property {function} isArray - {@link isArray}
271
- * @property {function} isBoolean - {@link isBoolean}
272
- * @property {function} isDate - {@link isDate}
273
- * @property {function} isElement - {@link isElement}
274
- * @property {function} isEmpty - {@link isEmpty}
275
- * @property {function} isFunction - {@link isFunction}
276
- * @property {function} isNull - {@link isNull}
277
- * @property {function} isNumber - {@link isNumber}
278
- * @property {function} isString - {@link isString}
279
- * @property {function} isUndefined - {@link isUndefined}
280
- * @property {function} isEmail - {@link isEmail}
281
- * @property {function} isNaN - {@link isNaN}
282
- * @property {function} isRegExp - {@link isRegExp}
283
- * @property {function} isUrl - {@link isUrl}
284
- * @property {function} isNodeList - {@link isNodeList}
285
- * @property {function} isHTMLCollection - {@link isHTMLCollection}
286
- * @property {function} isAMD - {@link isAMD}
287
- * @property {function} isFreeModule - {@link isFreeModule}
288
- * @property {function} getRoot - {@link getRoot}
289
- */
290
- is = {
291
- 'isArray':base(isArray),
292
- 'isBoolean':base(isBoolean),
293
- 'isDate':base(isDate),
294
- 'isElement':base(isElement),
295
- 'isEmpty':base(isEmpty),
296
- 'isFunction':base(isFunction),
297
- 'isNull':base(isNull),
298
- 'isNumber':base(isNumber),
299
- 'isObject':base(isObject),
300
- 'isString':base(isString),
301
- 'isUndefined':base(isUndefined),
302
- 'isEmail':base(isEmail),
303
- 'isNaN':base(isNaN),
304
- 'isRegExp':base(isRegExp),
305
- 'isUrl':base(isUrl),
306
- 'isNodeList':base(isNodeList),
307
- 'isHTMLCollection':base(isHTMLCollection),
308
- 'isAMD':base(isAMD),
309
- 'isFreeModule':base(isFreeModule),
310
- 'getRoot':getRoot
311
- }
312
-
313
-
314
- //
315
- is.isAMD(null,()=>{define(()=>is)},()=>{
316
- is.isFreeModule(null,()=>{ module.exports = is; },()=>{
317
- is.getRoot().ppIs = is
318
- })
319
- });
320
-
321
- }.call(this))