0.3.2 • Published 8 years ago
node-are v0.3.2
Project Moved!
are has been merged into vitals. Development will no longer occur on this repository. The old readme has been left below for historical reasons. Please direct all questions, issues, etc. to vitals.
are
Simple JS Type Checks
are will make your JavaScript development better! It contains two libraries, is and are, that will cover all of your data, object, and state type check needs. Their simple and intuitive APIs will make your projects easier to read and maintain while sustaining high performance. Take a look at some examples below.
Examples
- is
// example string checks
var val = 'a string';
is('string', val);
is('str', val);
is.string(val);
is.str(val);
// other examples
is('string|number', val); // is val a primitive string or number
is('!arrays|regexps', val); // is val a non-null array of arrays or regexps
is.document(val); // is val a DOM document instance
is.directory(val); // is val a valid directory path (for node.js only)
- are
// example string checks
var val1, val2, val3;
are('string', val1, val2, val3);
are('str', [ val1, val2, val3 ]);
are.string([ val1, val2, val3 ]);
are.str(val1, val2, val3);
// other examples
are('elem=', [ val1, val2, val3 ]); // is each val undefined, null, or a DOM element
are('?bool', val1, val2, val3); // is each val a boolean or null
are.empty(val1, val2, val3); // is each val empty (see docs for more info)
are.file([ val1, val2, val3 ]); // is each val a valid file path (for node.js only)
Install & Use
node.js
npm install node-are
require('node-are')(); // global.are and global.is now available
orvar are = require('node-are').are; var is = require('node-are').is;
browser
- download are.min.js
<script src="are.min.js"></script>
(add to html)window.is(...) && window.are(...)
(appended to window)
amd
- download are.min.js
require([ 'are' ], function(null) { ... })
window.is(...) && window.are(...)
(appended to window)
API Documentation
Other Details
contributing: see contributing guideline bugs/improvements: open an issue questions: learn@algorithmiv.com
-- Happy Developing,