Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

Commit 34edd41

Browse files
committed
Release 11.1.0
1 parent 2b39dda commit 34edd41

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

Diff for: History.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
11.1.0 / 2016-08-14
2+
===================
3+
4+
* Update modules
5+
16
11.0.0 / 2016-08-10
27
===================
38

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "should",
33
"description": "test framework agnostic BDD-style assertions",
4-
"version": "11.0.0",
4+
"version": "11.1.0",
55
"author": "TJ Holowaychuk <[email protected]>, Denis Bardadym <[email protected]> and other contributors",
66
"repository": {
77
"type": "git",
@@ -39,7 +39,7 @@
3939
"dependencies": {
4040
"should-equal": "^1.0.0",
4141
"should-format": "^3.0.1",
42-
"should-type": "^1.1.0",
42+
"should-type": "^1.4.0",
4343
"should-type-adaptors": "^1.0.0",
4444
"should-util": "^1.0.0"
4545
},

Diff for: should.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* should - test framework agnostic BDD-style assertions
3-
* @version v11.0.0
3+
* @version v11.1.0
44
* @author TJ Holowaychuk <[email protected]>, Denis Bardadym <[email protected]> and other contributors
55
* @link https://github.com/shouldjs/should.js
66
* @license MIT
@@ -52,9 +52,7 @@
5252
SIMD: 'simd'
5353
};
5454

55-
var toString = Object.prototype.toString;
56-
57-
/**
55+
/*
5856
* Simple data function to store type information
5957
* @param {string} type Usually what is returned from typeof
6058
* @param {string} cls Sanitized @Class via Object.prototype.toString
@@ -108,6 +106,10 @@
108106
}
109107
};
110108

109+
var toString = Object.prototype.toString;
110+
111+
112+
111113
/**
112114
* Function to store type checks
113115
* @private
@@ -122,6 +124,15 @@
122124
return this;
123125
},
124126

127+
addBeforeFirstMatch: function(obj, func) {
128+
var match = this.getFirstMatch(obj);
129+
if (match) {
130+
this.checks.splice(match.index, 0, func);
131+
} else {
132+
this.add(func);
133+
}
134+
},
135+
125136
addTypeOf: function(type, res) {
126137
return this.add(function(obj, tpeOf) {
127138
if (tpeOf === type) {
@@ -138,17 +149,21 @@
138149
});
139150
},
140151

141-
getType: function(obj) {
152+
getFirstMatch: function(obj) {
142153
var typeOf = typeof obj;
143154
var cls = toString.call(obj);
144155

145156
for (var i = 0, l = this.checks.length; i < l; i++) {
146157
var res = this.checks[i].call(this, obj, typeOf, cls);
147158
if (typeof res !== 'undefined') {
148-
return res;
159+
return { result: res, func: this.checks[i], index: i };
149160
}
150161
}
162+
},
151163

164+
getType: function(obj) {
165+
var match = this.getFirstMatch(obj);
166+
return match && match.result;
152167
}
153168
};
154169

0 commit comments

Comments
 (0)