Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
139 lines (107 sloc) 3.33 KB

Robb

Build Status

Contents

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.

Features

  • 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.

Version Description Size Action
robb.js uncompressed, with comments 5.49 KB (1.67 KB gzipped) Download
robb.min.js compressed, without comments 3.72 KB (1.27 KB gzipped) Download

Usage

Browser

<script src="robb.js"></script>

Node.js, RingoJS, Narwhal

var robb = require('robb');

RequireJS

// 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.