Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "types.js", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A tiny Javascript type-check library", | ||
@@ -5,0 +5,0 @@ "main": "types.min.js", |
types.js | ||
======== | ||
<br/> | ||
A tiny (1.8kb), but essential Javascript type checking library. | ||
A tiny (1.7kb), but essential Javascript type checking library. | ||
@@ -104,3 +104,7 @@ Especially in non-typed scripting languages like Javascript, proper manual type checking is crucial. | ||
**Types.parseIntBase** | ||
> `<Number> parseIntBase= 10` | ||
> Holds the Radix used by forceNumber, defaults to decimals. Can be set to valid radixes for parseInt(). | ||
**Types.forceBoolean** | ||
@@ -156,13 +160,21 @@ > `<String> Types.forceBoolean( value, replacement )` | ||
notNaN |isNaN |hasNaN |allNaN | ||
____________________________ | ||
**types.js type definitions:** | ||
'boolean', 'string', 'number', 'object', 'array', 'function', 'regexp', 'date', 'null', 'undefined', 'nan', 'unknown' | ||
____________________________ | ||
**types.js default literals** | ||
**force'Type' and default literals** | ||
Boolean `false` | String `''` | Number `0` | Object `{}` | Array `[]` | Function `function(){}` | ||
----------------|-------------|------------|-------------|------------|---------------- | ||
> format: `<string> forceString( <any type> value, <string> replacement )` | ||
forceBoolean |forceString |forceNumber | ||
---------------|--------------|-------------- | ||
Boolean `false`|String `''` |Number `0` | ||
forceObject |forceArray |forceFunction | ||
---------------|--------------|-------------- | ||
Object `{}` |Array `[]` |Function `function(){}` | ||
___ |
@@ -84,5 +84,2 @@ // Generated by CoffeeScript 1.8.0 | ||
}, | ||
'StringOrNumber': function(value) { | ||
return typesPredicates['String'](value) || typesPredicates['Number'](value); | ||
}, | ||
'Function': function(value) { | ||
@@ -111,2 +108,6 @@ return typeof value === 'function'; | ||
typesPredicates.StringOrNumber = function(value) { | ||
return typesPredicates['String'](value) || typesPredicates['Number'](value); | ||
}; | ||
breakIfEqual = true; | ||
@@ -113,0 +114,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var n,r,t,e,u,o;n={parseIntBase:10};e={Boolean:false,String:"",Number:0,Object:{},Array:[],Function:function(){}};t=function(r){var t;t=function(t){switch(r){case"Number":if(n.notNaN(t=parseInt(t,n.parseIntBase))){return t}break;case"String":if(n.isStringOrNumber(t)){return t+""}break;default:if(n["typeof"](t)===r.toLowerCase()){return t}}return false};return function(u,o){if(o==null){o=u}if(n["is"+r](u)){return u}if(false!==(o=t(o))){return o}return e[r]}};u=function(n,r,t){var e,u,o;if(t==null){t=[]}if(t.length<1){return false}for(u=0,o=t.length;u<o;u++){e=t[u];if(n(e)===r){return r}}return!r};o={Undefined:function(n){return n===void 0},Null:function(n){return n===null},Boolean:function(n){return typeof n==="boolean"},String:function(n){return typeof n==="string"},StringOrNumber:function(n){return o["String"](n)||o["Number"](n)},Function:function(n){return typeof n==="function"},Number:function(n){return typeof n==="number"&&n===n},Array:function(n){return typeof n==="object"&&n instanceof Array},RegExp:function(n){return n instanceof RegExp},Date:function(n){return n instanceof Date},Object:function(n){return typeof n==="object"&&!(n instanceof Array)&&!(n instanceof RegExp)&&!(n===null)},NaN:function(n){return typeof n==="number"&&n!==n}};r=true;(function(){var i,f,a;a=[];for(i in o){f=o[i];a.push(function(o,i){n["is"+o]=i;n["not"+o]=function(n){return!i(n)};n["has"+o]=function(){return u(i,r,arguments)};n["all"+o]=function(){return u(i,!r,arguments)};if(o in e){return n["force"+o]=t(o)}}(i,f))}return a})();n["typeof"]=function(n){var r,t;for(t in o){r=o[t];if(r(n)===true){return t.toLowerCase()}}return"unknown"};if(typeof window!=="undefined"&&window!==null){window.Types=n}else if(module){module.exports=n}}).call(this); | ||
(function(){"use strict";var n,r,t,e,u,o;n={parseIntBase:10};e={Boolean:false,String:"",Number:0,Object:{},Array:[],Function:function(){}};t=function(r){var t;t=function(t){switch(r){case"Number":if(n.notNaN(t=parseInt(t,n.parseIntBase))){return t}break;case"String":if(n.isStringOrNumber(t)){return t+""}break;default:if(n["typeof"](t)===r.toLowerCase()){return t}}return false};return function(u,o){if(o==null){o=u}if(n["is"+r](u)){return u}if(false!==(o=t(o))){return o}return e[r]}};u=function(n,r,t){var e,u,o;if(t==null){t=[]}if(t.length<1){return false}for(u=0,o=t.length;u<o;u++){e=t[u];if(n(e)===r){return r}}return!r};o={Undefined:function(n){return n===void 0},Null:function(n){return n===null},Boolean:function(n){return typeof n==="boolean"},String:function(n){return typeof n==="string"},Function:function(n){return typeof n==="function"},Number:function(n){return typeof n==="number"&&n===n},Array:function(n){return typeof n==="object"&&n instanceof Array},RegExp:function(n){return n instanceof RegExp},Date:function(n){return n instanceof Date},Object:function(n){return typeof n==="object"&&!(n instanceof Array)&&!(n instanceof RegExp)&&!(n===null)},NaN:function(n){return typeof n==="number"&&n!==n}};o.StringOrNumber=function(n){return o["String"](n)||o["Number"](n)};r=true;(function(){var i,f,a;a=[];for(i in o){f=o[i];a.push(function(o,i){n["is"+o]=i;n["not"+o]=function(n){return!i(n)};n["has"+o]=function(){return u(i,r,arguments)};n["all"+o]=function(){return u(i,!r,arguments)};if(o in e){return n["force"+o]=t(o)}}(i,f))}return a})();n["typeof"]=function(n){var r,t;for(t in o){r=o[t];if(r(n)===true){return t.toLowerCase()}}return"unknown"};if(typeof window!=="undefined"&&window!==null){window.Types=n}else if(module){module.exports=n}}).call(this); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52335
178