Comparing version 1.2.9 to 1.3.1
{ | ||
"name": "types.js", | ||
"version": "1.2.9", | ||
"version": "1.3.1", | ||
"description": "A tiny (1.7kb), but essential Javascript type-check library", | ||
@@ -5,0 +5,0 @@ "main": "types.min.js", |
@@ -50,4 +50,4 @@ types.js | ||
var x; | ||
// initialize a variable and be sure what type it will have in any case: | ||
var x; | ||
x= _.forceString(); // (empty String) | ||
@@ -62,5 +62,5 @@ x= _.forceString( null, 'ok' ); // ok (as String) | ||
// initialize your object: | ||
Client= function( name ){ | ||
var Client= function( name ){ | ||
this.name= _.forceString( name, 'no name given yet' ); | ||
} | ||
}; | ||
var unborn= new Client(); | ||
@@ -92,2 +92,3 @@ console.log( unborn.name ); // 'no name given yet' | ||
x= _.notUndefined( undefined ); // false | ||
x= _.isDefined( null ); // true | ||
@@ -188,2 +189,3 @@ // check multiple values in one call: | ||
notUndefined |isUndefined |hasUndefined |allUndefined | ||
notDefined |isDefined |hasDefined |allDefined | ||
notNaN |isNaN |hasNaN |allNaN | ||
@@ -206,1 +208,13 @@ | ||
`false` |`''` |`0` |`{}` |`[]` |`function(){}` | ||
change log | ||
========== | ||
1.3.1 | ||
Added: | ||
- change log in the readme, more convenient overview of changes. | ||
- is/not/has/allDefined<br/> | ||
Now you can: `if (_.isDefined(value) )`<br/> | ||
instead of `if (_.notUndefined(value) )` |
@@ -75,2 +75,5 @@ // Generated by CoffeeScript 1.8.0 | ||
typesPredicates = { | ||
'Defined': function(value) { | ||
return value !== void 0; | ||
}, | ||
'Undefined': function(value) { | ||
@@ -77,0 +80,0 @@ return value === void 0; |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var n,t,r,e,u,o;n={parseIntBase:10},e={Boolean:!1,String:"",Number:0,Object:{},Array:[],Function:function(){}},r=function(t){var r;return r=function(r){switch(t){case"Number":if(n.notNaN(r=parseInt(r,n.parseIntBase)))return r;break;case"String":if(n.isStringOrNumber(r))return r+"";break;default:if(n["is"+t](r))return r}return!1},function(n,u){return null==u&&(u=n),!1!==(n=r(n))?n:!1!==(u=r(u))?u:e[t]}},u=function(n,t,r){var e,u,i;if(null==r&&(r=[]),r.length<1)return n===o.Undefined?!0:!1;for(u=0,i=r.length;i>u;u++)if(e=r[u],n(e)===t)return t;return!t},o={Undefined:function(n){return void 0===n},Null:function(n){return null===n},Boolean:function(n){return"boolean"==typeof n},String:function(n){return"string"==typeof n},Function:function(n){return"function"==typeof n},Number:function(n){return"number"==typeof n&&n===n},Array:function(n){return"object"==typeof n&&n instanceof Array},RegExp:function(n){return"object"==typeof n&&n instanceof RegExp},Date:function(n){return"object"==typeof n&&n instanceof Date},Object:function(n){return!("object"!=typeof n||n instanceof Array||n instanceof RegExp||n instanceof Date||null===n)},NaN:function(n){return"number"==typeof n&&n!==n}},o.StringOrNumber=function(n){return o.String(n)||o.Number(n)},t=!0,function(){var i,f,c;c=[];for(i in o)f=o[i],c.push(function(o,i){return n["is"+o]=i,n["not"+o]=function(n){return!i(n)},n["has"+o]=function(){return u(i,t,arguments)},n["all"+o]=function(){return u(i,!t,arguments)},o in e?n["force"+o]=r(o):void 0}(i,f));return c}(),n["typeof"]=function(n){var t,r;for(r in o)if(t=o[r],t(n)===!0)return r.toLowerCase();return"unknown"},"undefined"!=typeof window&&null!==window?window.Types=n:module&&(module.exports=n)}).call(this); | ||
(function(){"use strict";var n,t,r,e,u,o;n={parseIntBase:10},e={Boolean:!1,String:"",Number:0,Object:{},Array:[],Function:function(){}},r=function(t){var r;return r=function(r){switch(t){case"Number":if(n.notNaN(r=parseInt(r,n.parseIntBase)))return r;break;case"String":if(n.isStringOrNumber(r))return r+"";break;default:if(n["is"+t](r))return r}return!1},function(n,u){return null==u&&(u=n),!1!==(n=r(n))?n:!1!==(u=r(u))?u:e[t]}},u=function(n,t,r){var e,u,i;if(null==r&&(r=[]),r.length<1)return n===o.Undefined?!0:!1;for(u=0,i=r.length;i>u;u++)if(e=r[u],n(e)===t)return t;return!t},o={Defined:function(n){return void 0!==n},Undefined:function(n){return void 0===n},Null:function(n){return null===n},Boolean:function(n){return"boolean"==typeof n},String:function(n){return"string"==typeof n},Function:function(n){return"function"==typeof n},Number:function(n){return"number"==typeof n&&n===n},Array:function(n){return"object"==typeof n&&n instanceof Array},RegExp:function(n){return"object"==typeof n&&n instanceof RegExp},Date:function(n){return"object"==typeof n&&n instanceof Date},Object:function(n){return!("object"!=typeof n||n instanceof Array||n instanceof RegExp||n instanceof Date||null===n)},NaN:function(n){return"number"==typeof n&&n!==n}},o.StringOrNumber=function(n){return o.String(n)||o.Number(n)},t=!0,function(){var i,f,c;c=[];for(i in o)f=o[i],c.push(function(o,i){return n["is"+o]=i,n["not"+o]=function(n){return!i(n)},n["has"+o]=function(){return u(i,t,arguments)},n["all"+o]=function(){return u(i,!t,arguments)},o in e?n["force"+o]=r(o):void 0}(i,f));return c}(),n["typeof"]=function(n){var t,r;for(r in o)if(t=o[r],t(n)===!0)return r.toLowerCase();return"unknown"},"undefined"!=typeof window&&null!==window?window.Types=n:module&&(module.exports=n)}).call(this); |
Sorry, the diff of this file is not supported yet
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
141421
1917
215