How to use the is.undef function in is

To help you get started, we’ve selected a few is examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leepowellcouk / mongoose-validator / lib / mongoose-validator.js View on Github external
const validate = function validate(options) {
  if (is.undef(options.validator)) {
    throw new Error('validator option undefined')
  }

  if (!is.function(options.validator) && !is.string(options.validator)) {
    throw new Error(
      `validator must be of type function or string, received ${typeof options.validator}`
    )
  }

  const validatorName = is.string(options.validator) ? options.validator : ''
  const validatorFn = getValidatorFn(options.validator)

  if (is.undef(validatorFn)) {
    throw new Error(
      `validator \`${validatorName}\` does not exist in validator.js or as a custom validator`
    )
  }

  const passIfEmpty = !!options.passIfEmpty
  const mongooseOpts = omit(
    options,
    'passIfEmpty',
    'message',
    'validator',
    'arguments'
  )
  const args = toArray(options.arguments)
  const messageStr = findFirstString(
    options.message,
github SamyPesse / blini / src / types / Map.js View on Github external
resolveFieldPath(value, field) {
        const { valueType } = this;
        const parts = fieldPath.split(field);
        const part  = parts.shift();
        const next  = fieldPath.join(...parts);

        const innerValue = value.get(part);

        if (is.undef(innerValue)) {
            return List();
        }

        return valueType.resolveFieldPath(innerValue, next)
            .map(path => fieldPath.join(field, path));
    }
}
github pedromsilvapt / unicast / src / Server / Providers / Manager.js View on Github external
identify ( source, type = null ) {
		let result;

		for ( let identifier of this.identifiers ) {
			result = identifier( source, type );

			if ( !is.undef( result ) ) {
				break;
			}
		}

		if ( is.undef( result ) ) {
			result = this.defaultProviderName;
		}

		return result;
	}
github thorgate / django-project-template / {{cookiecutter.repo_name}} / {{cookiecutter.repo_name}} / app-spa / src / server / router.js View on Github external
function getLanguage(cookies) {
    const language = cookies && cookies[DJ_CONST.LANGUAGE_COOKIE_NAME] || DJ_CONST.LANGUAGE_CODE;

    if (is.undef(DJ_CONST.LOCALE_DATA || {})[language]) {
        return DJ_CONST.LANGUAGE_CODE;
    }

    return language;
}
github pedromsilvapt / unicast / src / Server / Transcoders / Codecs / TrackCodec.js View on Github external
tracks ( metadata, criteria ) {
		if ( is.undef( criteria ) ) {
			criteria = this.criteria;
		}

		return _.where( metadata.streams, criteria );
	}
github thorgate / django-project-template / {{cookiecutter.repo_name}} / {{cookiecutter.repo_name}} / app / src / server / utils / language.js View on Github external
export default function getLanguage(ctx) {
    const cookies = ctx.cookie;
    const language = (cookies ? cookies[DJ_CONST.LANGUAGE_COOKIE_NAME] : null) || DJ_CONST.LANGUAGE_CODE;

    if (is.undef(DJ_CONST.LOCALE_DATA || {})[language]) {
        return DJ_CONST.LANGUAGE_CODE;
    }

    return language;
}

is

the definitive JavaScript type testing library

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis