-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
26 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"use strict"; | ||
|
||
var safeToString = require("../safe-to-string") | ||
, isPlainObject = require("./is-plain-object"); | ||
|
||
module.exports = function (value) { | ||
if (!isPlainObject(value)) throw new TypeError(safeToString(value) + " is not a plain object"); | ||
return value; | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use strict"; | ||
|
||
module.exports = function (t, a) { | ||
// Just sanity checks, as logic is tested at isPlainFunction | ||
var obj = {}; | ||
a(t(obj), obj, "Reguar object instance"); | ||
obj = Object.create(null); | ||
a(t(obj), obj, "Null prototype"); | ||
a.throws( | ||
function () { | ||
t(function () {}); | ||
}, | ||
TypeError, | ||
"Error" | ||
); | ||
}; |