Comparing version 2.3.0 to 2.3.1
@@ -11,2 +11,4 @@ "use strict"; | ||
exports.isNumber = isNumber; | ||
exports.isString = isString; | ||
exports.isBoolean = isBoolean; | ||
exports.isPlainObject = isPlainObject; | ||
@@ -101,1 +103,21 @@ exports.isArrayLike = isArrayLike; | ||
} | ||
/** | ||
Returns true if the input value is a string | ||
@param {*} - the input to test | ||
@returns {boolean} | ||
@static | ||
*/ | ||
function isString(input){ | ||
return typeof input === "string"; | ||
} | ||
/** | ||
Returns true if the input value is a boolean | ||
@param {*} - the input to test | ||
@returns {boolean} | ||
@static | ||
*/ | ||
function isBoolean(input){ | ||
return typeof input === "boolean"; | ||
} |
{ | ||
"name": "typical", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "For type-checking Javascript values.", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/75lb/typical.git", |
@@ -21,2 +21,4 @@ [![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical) | ||
* [.isDefined(input)](#module_typical.isDefined) ⇒ <code>boolean</code> | ||
* [.isString(input)](#module_typical.isString) ⇒ <code>boolean</code> | ||
* [.isBoolean(input)](#module_typical.isBoolean) ⇒ <code>boolean</code> | ||
@@ -112,5 +114,25 @@ <a name="module_typical.isNumber"></a> | ||
<a name="module_typical.isString"></a> | ||
### t.isString(input) ⇒ <code>boolean</code> | ||
Returns true if the input value is a string | ||
**Kind**: static method of <code>[typical](#module_typical)</code> | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
<a name="module_typical.isBoolean"></a> | ||
### t.isBoolean(input) ⇒ <code>boolean</code> | ||
Returns true if the input value is a boolean | ||
**Kind**: static method of <code>[typical](#module_typical)</code> | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| input | <code>\*</code> | the input to test | | ||
* * * | ||
© 2015 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). |
@@ -34,2 +34,22 @@ var test = require("tape"); | ||
t.end(); | ||
}); | ||
}); | ||
test(".isString(value)", function(t){ | ||
t.equal(type.isString(0), false); | ||
t.equal(type.isString("1"), true); | ||
t.equal(type.isString(1.1), false); | ||
t.equal(type.isString(NaN), false); | ||
t.equal(type.isString(Infinity), false); | ||
t.end(); | ||
}); | ||
test(".isBoolean(value)", function(t){ | ||
t.equal(type.isBoolean(true), true); | ||
t.equal(type.isBoolean(false), true); | ||
t.equal(type.isBoolean(0), false); | ||
t.equal(type.isBoolean("1"), false); | ||
t.equal(type.isBoolean(1.1), false); | ||
t.equal(type.isBoolean(NaN), false); | ||
t.equal(type.isBoolean(Infinity), false); | ||
t.end(); | ||
}); |
10113
160
137