Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "types.js", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A tiny Javascript type-check library", | ||
@@ -5,0 +5,0 @@ "main": "types.min.js", |
types.js | ||
======== | ||
A tiny (1.2kb), but essential Javascript type checking library. | ||
A tiny (1.3kb), but essential Javascript type checking library. | ||
@@ -23,2 +23,4 @@ Especially in non-typed scripting languages like Javascript, proper manual type checking is crucial. Unfortunately | ||
For use with node.js you can install with `npm install types.js` | ||
Basic usage: | ||
@@ -56,2 +58,3 @@ ------------ | ||
_.allString( '', ' ', 'with text', 123 ); // false | ||
_.allStringOrNumber( '', ' ', 'with text', 123 ); // true | ||
_.allObject( { key: 'nice' }, [], /regexp/ig ); // false | ||
@@ -62,2 +65,3 @@ _.allArray( [1,2,3], [{}], new RegExp('stop') ); // false | ||
_.hasString( 123, { value: 'nice' }, ['?'] ); // false | ||
_.hasStringOrNumber( [1,2], /reg/, 'true' ) // true | ||
_.hasFunction( 123, { value: 'nice' }, function(){} ); // true | ||
@@ -80,3 +84,4 @@ _.hasUndefined( 'render false!', 123, null ); // false | ||
> Returns a lowercase string representation of the type of value, according to types.js types. | ||
> Returns a lowercase string representation of the type of value, according to types.js types. See all types.js | ||
> type-definitions below. | ||
@@ -107,18 +112,17 @@ **Types.isBoolean** | ||
not |is |has |all | ||
:-----------------|:-------------------|:-------------------|:------------------ | ||
Types.notBoolean |Types.isBoolean |Types.hasBoolean |Types.allBoolean | ||
Types.notString |Types.isString |Types.hasString |Types.allString | ||
Types.notNumber |Types.isNumber |Types.hasNumber |Types.allNumber | ||
Types.notObject |Types.isObject |Types.hasObject |Types.allObject | ||
Types.notArray |Types.isArray |Types.hasArray |Types.allArray | ||
Types.notFunction |Types.isFunction |Types.hasFunction |Types.allFunction | ||
Types.notRegexp |Types.isRegexp |Types.hasRegexp |Types.allRegexp | ||
Types.notDate |Types.isDate |Types.hasDate |Types.allDate | ||
Types.notNull |Types.isNull |Types.hasNull |Types.allNull | ||
Types.notUndefined|Types.isUndefined |Types.hasUndefined |Types.allUndefined | ||
Types.notNaN |Types.isNaN |Types.hasNaN |Types.allNaN | ||
_____________________________ | ||
not |is |has |all | ||
:-----------------|:----------------|:----------------|:----------------- | ||
notBoolean |isBoolean |hasBoolean |allBoolean | ||
notString |isString |hasString |allString | ||
notNumber |isNumber |hasNumber |allNumber | ||
notStringOrNumber |isStringOrNumber |hasStringOrNumber|allStringOrNumber | ||
notObject |isObject |hasObject |allObject | ||
notArray |isArray |hasArray |allArray | ||
notFunction |isFunction |hasFunction |allFunction | ||
notRegexp |isRegexp |hasRegexp |allRegexp | ||
notDate |isDate |hasDate |allDate | ||
notNull |isNull |hasNull |allNull | ||
notUndefined |isUndefined |hasUndefined |allUndefined | ||
notNaN |isNaN |hasNaN |allNaN | ||
____________________________ | ||
**types.js type definitions:** | ||
@@ -125,0 +129,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var n,t,e,r;n={};e=function(n,t,e){var r,u,o;if(e==null){e=[]}if(e.length<1){return false}for(u=0,o=e.length;u<o;u++){r=e[u];if(n(r)===t){return t}}return!t};r={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}};t=true;(function(){var u,o,f;f=[];for(u in r){o=r[u];f.push(function(r,u){n["is"+r]=u;n["not"+r]=function(n){return!u(n)};n["has"+r]=function(){return e(u,t,arguments)};return n["all"+r]=function(){return e(u,!t,arguments)}}(u,o))}return f})();n["typeof"]=function(n){var t,e;for(e in r){t=r[e];if(t(n)===true){return e.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,t,r,e;n={};r=function(n,t,r){var e,u,o;if(r==null){r=[]}if(r.length<1){return false}for(u=0,o=r.length;u<o;u++){e=r[u];if(n(e)===t){return t}}return!t};e={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}};e.StringOrNumber=function(n){return e["String"](n)||e["Number"](n)};t=true;(function(){var u,o,i;i=[];for(u in e){o=e[u];i.push(function(e,u){n["is"+e]=u;n["not"+e]=function(n){return!u(n)};n["has"+e]=function(){return r(u,t,arguments)};return n["all"+e]=function(){return r(u,!t,arguments)}}(u,o))}return i})();n["typeof"]=function(n){var t,r;for(r in e){t=e[r];if(t(n)===true){return r.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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
47252
7
96
128
0