Comparing version 0.0.1 to 0.0.2
@@ -5,3 +5,3 @@ { | ||
"description": "Reusable Object.prototype.toString type checking library", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "https://github.com/nyteshade/isA.git" |
@@ -5,2 +5,11 @@ **isA.js** | ||
**Installation** | ||
To install the isA library, invoke | ||
```shell | ||
npm install isa-lib | ||
``` | ||
**About** | ||
Reusable node.js/browser JavaScript library that exposes some isXXX() type of functions. These functions do as much as possible to provide cross JavaScript VM compatible methods to determine whether or not an object is of a given type. | ||
@@ -21,3 +30,4 @@ | ||
console.log(isA("[object Number]", 5)); // true | ||
console.log(isA(Number(), 5)); // true | ||
console.log(isA(Number, 5)); // true | ||
console.log(isA(String, "Hi")); // true | ||
</script> | ||
@@ -31,7 +41,36 @@ ``` | ||
```javascript | ||
var isA = require('isA')(); // scoped to isA param | ||
var isA = require('isA')(global); // scoped to isA *AND* global | ||
var isA = require('isa-lib')(); // scoped to isA param | ||
var isA = require('isa-lib')(global); // scoped to isA *AND* global | ||
``` | ||
**Library contents** | ||
```javascript | ||
Function isA(type, object); | ||
Function isUndefined(object); | ||
Function isFunction(object); | ||
Function isBoolean(object); | ||
Function isObject(object); | ||
Function isRegExp(object); | ||
Function isString(object); | ||
Function isNumber(object); | ||
Function isArray(object); | ||
Function isError(object); | ||
Function isNull(object); | ||
// Function to inject this library to a JavaScript scope object | ||
Function INJECT_IS_A_LIB(scopeObject); | ||
// Anything less than 1 indicates pairs of incorrect type designations | ||
Number IS_A_ACCURACY | ||
// Array of pairs of types that incorrectly return the same value | ||
Array IS_A_QUESTIONABLE | ||
// Constants of known base types | ||
Object IS_A | ||
// Back reference to type string from constructor | ||
Array IS_A_BACKREF | ||
``` | ||
12534
74