UNPKG

isnullorempty

Version:
51 lines (44 loc) 2.68 kB
const isNullOrEmpty = require("./index.js"); //I was too lazy to write it properly. console.log("Constant test:"); console.log(" null -> %s", isNullOrEmpty(null)); console.log(" undefined -> %s", isNullOrEmpty(undefined)); console.log(" emptyStr -> %s", isNullOrEmpty("")); console.log(" emptyArr -> %s", isNullOrEmpty([])); console.log(" emptyObj -> %s", isNullOrEmpty({})); console.log(" \"abcdef\" -> %s", isNullOrEmpty("abcdef")); console.log("\nisNull test:"); console.log(" null -> %s", isNullOrEmpty.isNull(null)); console.log(" undefined -> %s", isNullOrEmpty.isNull(undefined)); console.log(" emptyStr -> %s", isNullOrEmpty.isNull("")); console.log(" emptyArr -> %s", isNullOrEmpty.isNull([])); console.log(" emptyObj -> %s", isNullOrEmpty.isNull({})); console.log(" \"abcdef\" -> %s", isNullOrEmpty.isNull("abcdef")); console.log("\nisEmpty test:"); console.log(" null -> %s", isNullOrEmpty.isEmpty(null)); console.log(" undefined -> %s", isNullOrEmpty.isEmpty(undefined)); console.log(" emptyStr -> %s", isNullOrEmpty.isEmpty("")); console.log(" emptyArr -> %s", isNullOrEmpty.isEmpty([])); console.log(" emptyObj -> %s", isNullOrEmpty.isEmpty({})); console.log(" \"abcdef\" -> %s", isNullOrEmpty.isEmpty("abcdef")); console.log("\nisUndefined test:"); console.log(" null -> %s", isNullOrEmpty.isUndefined(null)); console.log(" undefined -> %s", isNullOrEmpty.isUndefined(undefined)); console.log(" emptyStr -> %s", isNullOrEmpty.isUndefined("")); console.log(" emptyArr -> %s", isNullOrEmpty.isUndefined([])); console.log(" emptyObj -> %s", isNullOrEmpty.isUndefined({})); console.log(" \"abcdef\" -> %s", isNullOrEmpty.isUndefined("abcdef")); console.log("\nisNullOrEmpty test:"); console.log(" null -> %s", isNullOrEmpty.isNullOrEmpty(null)); console.log(" undefined -> %s", isNullOrEmpty.isNullOrEmpty(undefined)); console.log(" emptyStr -> %s", isNullOrEmpty.isNullOrEmpty("")); console.log(" emptyArr -> %s", isNullOrEmpty.isNullOrEmpty([])); console.log(" emptyObj -> %s", isNullOrEmpty.isNullOrEmpty({})); console.log(" \"abcdef\" -> %s", isNullOrEmpty.isNullOrEmpty("abcdef")); console.log("\nisNullOrUndefined test:"); console.log(" null -> %s", isNullOrEmpty.isNullOrUndefined(null)); console.log(" undefined -> %s", isNullOrEmpty.isNullOrUndefined(undefined)); console.log(" emptyStr -> %s", isNullOrEmpty.isNullOrUndefined("")); console.log(" emptyArr -> %s", isNullOrEmpty.isNullOrUndefined([])); console.log(" emptyObj -> %s", isNullOrEmpty.isNullOrUndefined({})); console.log(" \"abcdef\" -> %s", isNullOrEmpty.isNullOrUndefined("abcdef"));