Permalink
Browse files

add boolean type

  • Loading branch information...
XadillaX committed Nov 2, 2015
1 parent 3ae37d2 commit 7ee1c910cbace468898c91ccbabd278a1c9fb393
Showing with 45 additions and 219 deletions.
  1. +45 −0 lib/fieldType/boolean.js
  2. +0 −219 npm-shrinkwrap.json
@@ -0,0 +1,45 @@
/**
* XadillaX created at 2015-11-02 10:40:53 With ♥
*
* Copyright (c) 2015 Souche.com, all rights
* reserved.
*/
"use strict";

var _Boolean = {};
_Boolean.name = "_Boolean";
_Boolean.needQuotes = false;

/**
* restore
* @param {_Boolean} parsed the parsed integer
* @return {Number} the integer restored
*/
_Boolean.restore = function(parsed) {
return (parsed ^ 0) & 1;
};

/**
* parse
* @param {Number} orig the original integer
* @return {_Boolean} the boolean value
*/
_Boolean.parse = function(orig) {
return !!orig;
};

_Boolean.defaultValue = 0;

/**
* equal
* @param {Number|Boolean} a integer I
* @param {Number|Boolean} b integer II
* @return {Boolean} whether they are equal
*/
_Boolean.equal = function(a, b) {
a = !!a;
b = !!b;
return a === b;
};

module.exports = _Boolean;

This file was deleted.

Oops, something went wrong.

0 comments on commit 7ee1c91

Please sign in to comment.