Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add boolean type
  • Loading branch information
XadillaX committed Nov 2, 2015
1 parent 3ae37d2 commit 7ee1c91
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 219 deletions.
45 changes: 45 additions & 0 deletions lib/fieldType/boolean.js
@@ -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;
219 changes: 0 additions & 219 deletions npm-shrinkwrap.json

This file was deleted.

0 comments on commit 7ee1c91

Please sign in to comment.