How to use the nil function from is

Find comprehensive JavaScript is.nil code examples handpicked from public code repositorys.

41
42
43
44
45
46
47
48
49
50
  );

const createValidator = (fn, args, passIfEmpty) => {
  const validator = (val) => {
    const validatorArgs = [val].concat(args);
    if ((passIfEmpty && (is.empty(val) || is.nil(val))) || is.undef(val)) {
      return true;
    }
    return fn.apply(this, validatorArgs);
  };
fork icon47
star icon382
watch icon4

+ 4 other calls in file

66
67
68
69
70
71
72
73
74
75
  message.replace(/{ARGS\[(\d+)\]}/g, (match, submatch) => args[submatch] || '')

const createValidator = function createValidator (fn, args, passIfEmpty) {
  return function validator (val) {
    const validatorArgs = [val].concat(args)
    if ((passIfEmpty && (is.empty(val) || is.nil(val))) || is.undef(val)) {
      return true
    }
    return fn.apply(this, validatorArgs)
  }
fork icon47
star icon1
watch icon7

-1
fork icon9
star icon0
watch icon4

+ 3 other calls in file

38
39
40
41
42
43
44
45
46
// In CJS
const is = require('is');
// In ES, TS modules
// import is from 'is';

const checkNull:boolean = is.nil(null); // checkNull=true
```

##### With @pbbbl/is
fork icon0
star icon0
watch icon0

+ 7 other calls in file