Skip to content

Commit

Permalink
Fix set iterableToString test on IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfcosta authored and fatso83 committed Jan 2, 2017
1 parent 3500d60 commit a6d8e14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 3 additions & 7 deletions lib/sinon/typeOf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
*/
"use strict";

var type = require("type-detect");

module.exports = function typeOf(value) {
if (value === null) {
return "null";
} else if (value === undefined) {
return "undefined";
}
var string = Object.prototype.toString.call(value);
return string.substring(8, string.length - 1).toLowerCase();
return type(value).toLowerCase();
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"native-promise-only": "^0.8.1",
"path-to-regexp": "^1.7.0",
"samsam": "^1.1.3",
"text-encoding": "0.6.2"
"text-encoding": "0.6.2",
"type-detect": "^4.0.0"
},
"devDependencies": {
"browserify": "^13.0.0",
Expand Down
8 changes: 7 additions & 1 deletion test/util/core/iterable-to-string-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ describe("util/core/iterable-to-string", function () {

if (typeof Set === "function") {
it("returns an String representation of Set objects", function () {
var set = new Set([1, "one", true, undefined, null]);
var set = new Set();
set.add(1);
set.add("one");
set.add(true);
set.add(undefined);
set.add(null);

var expected = "1,'one',true,undefined,null";

assert.equals(iterableToString(set), expected);
Expand Down

0 comments on commit a6d8e14

Please sign in to comment.