added unit testing, and started implementing unit tests...phew
This commit is contained in:
35
node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
35
node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
var getClass = require("./get-class");
|
||||
|
||||
/**
|
||||
* @name samsam.isArguments
|
||||
* @param Object object
|
||||
*
|
||||
* Returns ``true`` if ``object`` is an ``arguments`` object,
|
||||
* ``false`` otherwise.
|
||||
*/
|
||||
function isArguments(object) {
|
||||
if (getClass(object) === "Arguments") {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
typeof object !== "object" ||
|
||||
typeof object.length !== "number" ||
|
||||
getClass(object) === "Array"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (typeof object.callee === "function") {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
object[object.length] = 6;
|
||||
delete object[object.length];
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = isArguments;
|
Reference in New Issue
Block a user