How to use the type-detect.Library function in type-detect

To help you get started, we’ve selected a few type-detect 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 qualiancy / seed / lib / filter / util.js View on Github external
/*!
 * Seed :: Query (utils) - MongoDB style array filtering
 * Copyright(c) 2011-2014 Jake Luer 
 * MIT Licensed
 */

var pathval = require('pathval');
var type = require('type-detect').Library();

var comparators = require('./comparators');

/*!
 * Custom type
 */

type.define('simplex', function(o) {
  if ('string' === type.of(o)) return true;
  if ('number' === type.of(o)) return true;
  if ('boolean' === type.of(o)) return true;
  return false;
})

/*!
 * Given the query input, create a re-usable definition

type-detect

Improved typeof detection for node.js and the browser.

MIT
Latest version published 5 months ago

Package Health Score

76 / 100
Full package analysis

Popular type-detect functions