Created
July 1, 2015 19:46
-
-
Save lorenzoongithub/89733e1dc8e1a02c34f2 to your computer and use it in GitHub Desktop.
xtypejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// http://xtype.js.org | |
// Elegant, highly efficient data validation for JavaScript | |
// | |
load('https://rawgit.com/lucono/xtypejs/master/xtype.js'); | |
x = xtype.isSingleCharString('g') | |
if (x !== true) throw ''; | |
x = xtype.isNonEmptyObject({foo: 'bar'}) | |
if (x !== true) throw ''; | |
x = xtype.isSingleElemArray(['foo']) | |
if (x !== true) throw ''; | |
x = xtype.isFloat(2.50); | |
if (x !== true) throw ''; | |
x = xtype.isPositiveNumber(-2.5); | |
if (x) throw ''; | |
x = xtype.isNan(5 / 'hi') | |
if (x !== true) throw ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment