Current Folder
This commit is contained in:
1 parent
8b3382289b
commit
cfcada880d
4379 files changed
No files matched your search
-18
@@ -1,18 +0,0 @@
|
||||
module.exports = isFunction
|
||||
|
||||
var toString = Object.prototype.toString
|
||||
|
||||
function isFunction (fn) {
|
||||
if (!fn) {
|
||||
return false
|
||||
}
|
||||
var string = toString.call(fn)
|
||||
return string === '[object Function]' ||
|
||||
(typeof fn === 'function' && string !== '[object RegExp]') ||
|
||||
(typeof window !== 'undefined' &&
|
||||
// IE8 and below
|
||||
(fn === window.setTimeout ||
|
||||
fn === window.alert ||
|
||||
fn === window.confirm ||
|
||||
fn === window.prompt))
|
||||
};
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"name": "is-function",
|
||||
"version": "1.0.2",
|
||||
"description": "is that thing a function? Use this module to find out",
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tape": "~2.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/grncdr/js-is-function.git"
|
||||
},
|
||||
"homepage": "https://github.com/grncdr/js-is-function",
|
||||
"keywords": [
|
||||
"polyfill",
|
||||
"is-function",
|
||||
"ie6"
|
||||
],
|
||||
"author": "Stephen Sugden <me@stephensugden.com>",
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz"
|
||||
,"_integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ=="
|
||||
,"_from": "is-function@^1.0.1"
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
var test = require('tape')
|
||||
var isFunction = require('./index.js')
|
||||
|
||||
test('isFunction', function (t) {
|
||||
t.ok(!isFunction(), 'undefined is not a function')
|
||||
t.ok(!isFunction(null), 'null is not a function')
|
||||
t.ok(!isFunction(''), 'string is not a function')
|
||||
t.ok(!isFunction(/a/), 'regex is not a function')
|
||||
t.ok(!isFunction(true), 'true is not a function')
|
||||
t.ok(!isFunction(false), 'false is not a function')
|
||||
t.ok(!isFunction(NaN), 'NaN is not a function')
|
||||
t.ok(!isFunction(42), '42 is not a function')
|
||||
t.ok(isFunction(function () {}), 'function is a function')
|
||||
t.ok(isFunction(setTimeout), 'setTimeout is a function')
|
||||
t.end()
|
||||
})
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
test('browser quirks', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
t.ok(isFunction(window.alert), 'alert is a function')
|
||||
|
||||
window.testRegExpFromIframe = function (regexp) {
|
||||
t.ok(!isFunction(regexp))
|
||||
}
|
||||
|
||||
var iframe = document.createElement('iframe')
|
||||
document.body.appendChild(iframe)
|
||||
|
||||
iframe.contentWindow.document.write([
|
||||
"<html><body><script type=\"text/javascript\">",
|
||||
"parent.testRegExpFromIframe(/a/)",
|
||||
"</script></body></html>"
|
||||
].join("\n"));
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user