robb

Simple type checker in JavaScript.

Robb

Robb is simple type checker in JavaScript. It was originally designed for use with Node.js, but you can use it also in the browser.

  • Robb has no dependencies
  • AMD compatible, you can load it via RequireJS
  • Lightweight
  • Fully documented

Example

Robb.isNuber(123); // => true 
Robb.isArray([1, 2, 3]); // => true 
Robb.isBoolean(false); // => true 
Robb.isEmail('hello1@example.com', 'hello2@example.com'); // => true 

Download

To install Robb, use NPM.

$ npm install robb

Releases are available for download from GitHub.

VersionDescriptionSizeAction
robb.jsuncompressed, with comments1 KBDownload
robb.min.jscompressed, without comments1 KBDownload

Usage

<script src="robb.js"></script>
var platform = require('platform');
// Configuration options, the path should not include the .js extension 
require.config({
  paths: {
    "robb": "path/to/robb"
  }
});
 
// Load Robb 
require(['robb'], function(robb) {
 
  // Do something... 
 
});

Methods

  • isAlpha
  • isAlphanumeric
  • isArguments
  • isArray
  • isBoolean
  • isDate
  • isDecimal
  • isDefined
  • isElement
  • isEmail
  • isEmpty
  • isEven
  • isFinite
  • isFunction
  • isInt
  • isIp
  • isIpv4
  • isIpv6
  • isLowercase
  • isNaN
  • isNegative
  • isNull
  • isNumber
  • isObject
  • isOdd
  • isPercentage
  • isPort
  • isPositive
  • isPrime
  • isRegExp
  • isString
  • isUndefined
  • isUnsignedInt
  • isUppercase
  • isUrl
  • isWindow

Tests

$ npm test

License

(The MIT License)

Copyright (c) 2011 František Hába <hello@frantisekhaba.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.