Comparing version
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
@@ -9,0 +9,0 @@ "authors": [ |
{ | ||
"name": "divhide", | ||
"description": "Divhide javascript core components for NodeJs, Browser, Titanium, ... and everything that runs javascript.", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Oscar Brito <aetheon@gmail.com>", |
@@ -539,2 +539,6 @@ # [](http://divhide.com/) divhide-core | ||
`.boolean()` | ||
<br /> | ||
Set the expected type as a boolean | ||
`.object(value)` | ||
@@ -541,0 +545,0 @@ <br /> |
@@ -90,3 +90,3 @@ 'use strict'; | ||
function : function(val, obj){ | ||
function : function(){ | ||
this.schema = function(){}; | ||
@@ -97,3 +97,3 @@ this.required = true; | ||
number : function(val){ | ||
number : function(){ | ||
this.schema = 0; | ||
@@ -104,2 +104,8 @@ this.required = true; | ||
boolean : function(){ | ||
this.schema = Boolean(true); | ||
this.required = true; | ||
this.any = false; | ||
}, | ||
default : function(val, defaultValue){ | ||
@@ -106,0 +112,0 @@ this.default = defaultValue; |
@@ -19,2 +19,6 @@ | ||
`.boolean()` | ||
<br /> | ||
Set the expected type as a boolean | ||
`.object(value)` | ||
@@ -21,0 +25,0 @@ <br /> |
@@ -83,2 +83,18 @@ "use strict"; | ||
boolean: function(value){ | ||
if(!Type.isBoolean(value)){ | ||
return; | ||
} | ||
// no default value and its required! | ||
value = new SchemaDefinition({ | ||
schema: Boolean(value), | ||
required: true | ||
}); | ||
return value; | ||
}, | ||
function: function(value){ | ||
@@ -98,3 +114,3 @@ | ||
} | ||
}, | ||
@@ -130,3 +146,3 @@ }; | ||
Defaults.string(schema) || Defaults.number(schema) || | ||
Defaults.function(schema); | ||
Defaults.boolean(schema) || Defaults.function(schema); | ||
@@ -133,0 +149,0 @@ if(!result){ |
@@ -30,4 +30,8 @@ 'use strict'; | ||
if(t == "object" && obj instanceof Array) | ||
if(t == "object" && obj instanceof Array){ | ||
return "array"; | ||
} | ||
else if(t == "object" && typeof(obj) == "boolean"){ | ||
return "boolean"; | ||
} | ||
@@ -34,0 +38,0 @@ return t; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1616288
0.18%25211
0.25%1506
0.27%