This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
11.1.0 / 2016-08-14 | ||
=================== | ||
|
||
* Update modules | ||
|
||
11.0.0 / 2016-08-10 | ||
=================== | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "should", | ||
"description": "test framework agnostic BDD-style assertions", | ||
"version": "11.0.0", | ||
"version": "11.1.0", | ||
"author": "TJ Holowaychuk <[email protected]>, Denis Bardadym <[email protected]> and other contributors", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -39,7 +39,7 @@ | |
"dependencies": { | ||
"should-equal": "^1.0.0", | ||
"should-format": "^3.0.1", | ||
"should-type": "^1.1.0", | ||
"should-type": "^1.4.0", | ||
"should-type-adaptors": "^1.0.0", | ||
"should-util": "^1.0.0" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/*! | ||
* should - test framework agnostic BDD-style assertions | ||
* @version v11.0.0 | ||
* @version v11.1.0 | ||
* @author TJ Holowaychuk <[email protected]>, Denis Bardadym <[email protected]> and other contributors | ||
* @link https://github.com/shouldjs/should.js | ||
* @license MIT | ||
|
@@ -52,9 +52,7 @@ | |
SIMD: 'simd' | ||
}; | ||
|
||
var toString = Object.prototype.toString; | ||
|
||
/** | ||
/* | ||
* Simple data function to store type information | ||
* @param {string} type Usually what is returned from typeof | ||
* @param {string} cls Sanitized @Class via Object.prototype.toString | ||
|
@@ -108,6 +106,10 @@ | |
} | ||
}; | ||
|
||
var toString = Object.prototype.toString; | ||
|
||
|
||
|
||
/** | ||
* Function to store type checks | ||
* @private | ||
|
@@ -122,6 +124,15 @@ | |
return this; | ||
}, | ||
|
||
addBeforeFirstMatch: function(obj, func) { | ||
var match = this.getFirstMatch(obj); | ||
if (match) { | ||
this.checks.splice(match.index, 0, func); | ||
} else { | ||
this.add(func); | ||
} | ||
}, | ||
|
||
addTypeOf: function(type, res) { | ||
return this.add(function(obj, tpeOf) { | ||
if (tpeOf === type) { | ||
|
@@ -138,17 +149,21 @@ | |
}); | ||
}, | ||
|
||
getType: function(obj) { | ||
getFirstMatch: function(obj) { | ||
var typeOf = typeof obj; | ||
var cls = toString.call(obj); | ||
|
||
for (var i = 0, l = this.checks.length; i < l; i++) { | ||
var res = this.checks[i].call(this, obj, typeOf, cls); | ||
if (typeof res !== 'undefined') { | ||
return res; | ||
return { result: res, func: this.checks[i], index: i }; | ||
} | ||
} | ||
}, | ||
|
||
getType: function(obj) { | ||
var match = this.getFirstMatch(obj); | ||
return match && match.result; | ||
} | ||
}; | ||
|
||
|