Is_a_type
`breads.types`
Function: exists. Returns true if value isn't null or undefined, else returns false.
exists. Returns true if value isn't null or undefined, else returns false.function exists(val: any): boolean;Example:
const exists = require("103-breads").types.exists;
let something;
console.log(exists(something)); // false (not defined)
something = null;
console.log(exists(something)); // false (null)
something = "Hello!";
console.log(exists(something)); // true (has a value)Function: isFunction. Returns true if value is a function, false otherwise. (The function does not execute)
isFunction. Returns true if value is a function, false otherwise. (The function does not execute)function isFunction(val: any): boolean;Example:
const isFunction = require("103-breads").types.isFunction;
function myFunc(test = "Hi!") {
console.log(test);
}
console.log(isFunction(myFunc)); // true, function doesn't execute
console.log(isFunction("Hello!")); // falseFunction: isNumber. Returns true if value is a number, false otherwise.
isNumber. Returns true if value is a number, false otherwise.Example:
Function: isObject. Returns true if value is an object, false otherwise.
isObject. Returns true if value is an object, false otherwise.Example:
Function: isString. Returns true if value is an String object or it has a type of "string", false otherwise.
isString. Returns true if value is an String object or it has a type of "string", false otherwise.Example:
Last updated
Was this helpful?