How to use the typechecker.isArray function in typechecker

To help you get started, we’ve selected a few typechecker 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 bevry-archive / feedr / source / index.js View on Github external
// Check deprecations
		if (feed.checkReponse) {
			next(new Error('Feed checkResponse option is deprecated for check'))
			return this
		}

		// Ensure optional
		feed = this.prepareFeed(feed)

		// Plugins
		const plugins = {}
		if (typeChecker.isString(feed.plugins)) {
			feed.plugins = feed.plugins.split(' ')
		}
		if (typeChecker.isArray(feed.plugins)) {
			for (let i = 0; i < feed.plugins.length; ++i) {
				const name = feed.plugins[i]
				try {
					plugins[name] = require('./plugins/' + name)
				} catch (err) {
					next(err)
					return this
				}
			}
		}

		// Generators
		function generateParser(name, method, opts, complete) {
			me.log('debug', `Feedr parse [${feed.url}] with ${name} attempt`)
			method(opts, function(err, data) {
				if (err) {
github sx1989827 / DOClever / Desktop / node_modules / eachr / source / index.js View on Github external
module.exports = function eachr (subject, callback) {
	// Handle
	if ( typeChecker.isArray(subject) ) {
		for ( let key = 0; key < subject.length; ++key ) {
			const value = subject[key]
			if ( callback.call(subject, value, key, subject) === false ) {
				break
			}
		}
	}
	else if ( typeChecker.isPlainObject(subject) ) {
		for ( const key in subject ) {
			if ( subject.hasOwnProperty(key) ) {
				const value = subject[key]
				if ( callback.call(subject, value, key, subject) === false ) {
					break
				}
			}
		}
github sx1989827 / DOClever / Desktop / node_modules / eachr / es2015 / index.js View on Github external
module.exports = function eachr(subject, callback) {
	// Handle
	if (typeChecker.isArray(subject)) {
		for (var key = 0; key < subject.length; ++key) {
			var value = subject[key];
			if (callback.call(subject, value, key, subject) === false) {
				break;
			}
		}
	} else if (typeChecker.isPlainObject(subject)) {
		for (var _key in subject) {
			if (subject.hasOwnProperty(_key)) {
				var _value = subject[_key];
				if (callback.call(subject, _value, _key, subject) === false) {
					break;
				}
			}
		}
	} else if (typeChecker.isMap(subject)) {
github sx1989827 / DOClever / Desktop / node_modules / extract-opts / source / index.js View on Github external
module.exports = function (opts, next, config = {}) {
	// Empty, set default
	if ( config.completionCallbackNames == null ) {
		config.completionCallbackNames = ['next']
	}

	// Not array, make array
	else if ( typeChecker.isArray(config.completionCallbackNames) === false ) {
		config.completionCallbackNames = [config.completionCallbackNames]
	}

	// Arguments
	if ( typeChecker.isFunction(opts) && next == null ) {
		next = opts
		opts = {}
	}
	else if ( !opts ) {
		opts = {}
	}

	// Completion callback
	if ( !next ) {
		// Cycle the completionCallbackNames to check if the completion callback name exists in opts
		// if it does, then use it as the next and delete it's value
github sx1989827 / DOClever / Desktop / node_modules / extract-opts / es2015 / index.js View on Github external
module.exports = function (opts, next) {
	var config = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

	// Empty, set default
	if (config.completionCallbackNames == null) {
		config.completionCallbackNames = ['next'];
	}

	// Not array, make array
	else if (typeChecker.isArray(config.completionCallbackNames) === false) {
			config.completionCallbackNames = [config.completionCallbackNames];
		}

	// Arguments
	if (typeChecker.isFunction(opts) && next == null) {
		next = opts;
		opts = {};
	} else if (!opts) {
		opts = {};
	}

	// Completion callback
	if (!next) {
		// Cycle the completionCallbackNames to check if the completion callback name exists in opts
		// if it does, then use it as the next and delete it's value
		eachr(config.completionCallbackNames, function (completionCallbackName) {
github bevry-archive / feedr / source / index.js View on Github external
args.forEach(function(arg, index) {
			if (typeChecker.isFunction(arg)) {
				next = arg
			} else if (typeChecker.isArray(arg)) {
				feeds = arg
			} else if (typeChecker.isPlainObject(arg)) {
				if (index === 0) {
					feeds = arg
				} else {
					extendr.extend(defaultfeed, arg)
				}
			}
		})
github nfriedly / nfriedly.com / node_modules / docpad / out / lib / util.js View on Github external
getExtension: function(extensions) {
      var extension;
      if (!require('typechecker').isArray(extensions)) {
        extensions = docpadUtil.getExtensions(extensions);
      }
      if (extensions.length !== 0) {
        extension = extensions.slice(-1)[0] || null;
      } else {
        extension = null;
      }
      return extension;
    },
    getDirPath: function(path) {

typechecker

Utilities to get and check variable types (isString, isPlainObject, isRegExp, etc)

Artistic-2.0
Latest version published 7 months ago

Package Health Score

70 / 100
Full package analysis