lib with functions for utils
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
		
							parent
							
								
									3896c7778a
								
							
						
					
					
						commit
						8469e04a98
					
				|  | @ -1,3 +1,9 @@ | |||
| const { | ||||
|   isString, | ||||
|   isObject, | ||||
|   isDefined | ||||
| } = require("../../utils/fun.js"); | ||||
| 
 | ||||
| function JSONParser() { | ||||
| 
 | ||||
| } | ||||
|  | @ -9,9 +15,6 @@ const nullOrIndefinedPayload = | |||
|   new Error("null or undefined payload"); | ||||
| 
 | ||||
| // Functions
 | ||||
| const isString = (v) => (typeof v) === "string"; | ||||
| const isObject = (v) => (typeof v) === "object"; | ||||
| const isDefined = (v) => v && (typeof v) != "undefined"; | ||||
| const isDefinedOrThrow = (v) => | ||||
|   (isDefined(v) | ||||
|     ?  () => true | ||||
|  |  | |||
|  | @ -0,0 +1,10 @@ | |||
| // Functional approach
 | ||||
| const isString = (v) => (typeof v) === "string"; | ||||
| const isObject = (v) => (typeof v) === "object"; | ||||
| const isDefined = (v) => v && (typeof v) != "undefined"; | ||||
| 
 | ||||
| module.exports = { | ||||
|   isString  : isString, | ||||
|   isObject  : isObject, | ||||
|   isDefined : isDefined | ||||
| }; | ||||
		Loading…
	
		Reference in New Issue