extension-props
Advanced tools
Comparing version 0.9.5 to 0.9.6
@@ -1,2 +0,2 @@ | ||
import { defineFunction, functionForInstance, isArrowFunction, isAsyncFunction, isNonArrowFunction, isNormalFunction, isSyncFunction } from '../utils/ClassAndFunction'; | ||
import { defineFunction, functionForInstance, isArrowFunction, isAsyncFunction, isCallable, isNonArrowFunction, isNormalFunction, isSyncFunction } from '../utils/ClassAndFunction'; | ||
interface FunctionType { | ||
@@ -11,2 +11,3 @@ clone(): Function; | ||
defineFunction: typeof defineFunction; | ||
isCallable: typeof isCallable; | ||
isNormalFunction: typeof isNormalFunction; | ||
@@ -13,0 +14,0 @@ isAsyncFunction: typeof isAsyncFunction; |
@@ -16,2 +16,3 @@ "use strict"; | ||
defineFunction: ClassAndFunction_1.defineFunction, | ||
isCallable: ClassAndFunction_1.isCallable, | ||
isNormalFunction: ClassAndFunction_1.isNormalFunction, | ||
@@ -26,2 +27,3 @@ isAsyncFunction: ClassAndFunction_1.isAsyncFunction, | ||
Function.defineFunction = ClassAndFunction_1.defineFunction; | ||
Function.isCallable = ClassAndFunction_1.isCallable; | ||
Function.isNormalFunction = ClassAndFunction_1.isNormalFunction; | ||
@@ -28,0 +30,0 @@ Function.isAsyncFunction = ClassAndFunction_1.isAsyncFunction; |
@@ -9,2 +9,3 @@ import { | ||
isAsyncFunction, | ||
isCallable, | ||
isNonArrowFunction, | ||
@@ -35,2 +36,3 @@ isNormalFunction, | ||
defineFunction, | ||
isCallable, | ||
isNormalFunction, | ||
@@ -46,2 +48,3 @@ isAsyncFunction, | ||
Function.defineFunction = defineFunction; | ||
Function.isCallable = isCallable; | ||
Function.isNormalFunction = isNormalFunction; | ||
@@ -48,0 +51,0 @@ Function.isAsyncFunction = isAsyncFunction; |
@@ -51,2 +51,3 @@ interface String { | ||
getAllPropertyNames(obj: any): string[]; | ||
isCallable(f: Function): boolean; | ||
isNormalFunction(f: Function): boolean; | ||
@@ -53,0 +54,0 @@ isAsyncFunction(f: Function): boolean; |
@@ -25,1 +25,2 @@ export declare function functionForInstance(v: any): boolean; | ||
export declare function isNonArrowFunction(f: Function): boolean; | ||
export declare function isCallable(f: Function): boolean; |
@@ -203,3 +203,3 @@ "use strict"; | ||
function isNormalFunction(f) { | ||
return f instanceof Function && f.prototype !== undefined; | ||
return f instanceof Function && !isES6Class(f) && f.prototype !== undefined; | ||
} | ||
@@ -221,3 +221,3 @@ exports.isNormalFunction = isNormalFunction; | ||
function isSyncFunction(f) { | ||
if (f instanceof Function) { | ||
if (f instanceof Function && !isES6Class(f)) { | ||
try { | ||
@@ -247,3 +247,3 @@ return f[Symbol.toStringTag] !== 'AsyncFunction'; | ||
function isNonArrowFunction(f) { | ||
if (f instanceof Function) { | ||
if (f instanceof Function && !isES6Class(f)) { | ||
var fstr = f.toString(); | ||
@@ -259,1 +259,10 @@ if (f.prototype !== undefined || /^\s*function/.test(fstr) || /^\s*async\s*function/.test(fstr)) | ||
exports.isNonArrowFunction = isNonArrowFunction; | ||
function isCallable(f) { | ||
if (f instanceof Function) { | ||
if (!f.prototype) | ||
return true; | ||
return !isES6Class(f); | ||
} | ||
return false; | ||
} | ||
exports.isCallable = isCallable; |
@@ -186,3 +186,3 @@ export function functionForInstance(v: any): boolean { | ||
export function isNormalFunction(f: Function): boolean { | ||
return f instanceof Function && f.prototype !== undefined; | ||
return f instanceof Function && !isES6Class(f) && f.prototype !== undefined; | ||
} | ||
@@ -201,3 +201,3 @@ | ||
export function isSyncFunction(f: Function): boolean { | ||
if (f instanceof Function) { | ||
if (f instanceof Function && !isES6Class(f)) { | ||
try { | ||
@@ -222,3 +222,3 @@ return f[Symbol.toStringTag] !== 'AsyncFunction'; | ||
export function isNonArrowFunction(f: Function): boolean { | ||
if (f instanceof Function) { | ||
if (f instanceof Function && !isES6Class(f)) { | ||
const fstr = f.toString(); | ||
@@ -231,1 +231,9 @@ if (f.prototype !== undefined || /^\s*function/.test(fstr) || /^\s*async\s*function/.test(fstr)) | ||
} | ||
export function isCallable(f: Function): boolean { | ||
if (f instanceof Function) { | ||
if (!f.prototype) return true; | ||
return !isES6Class(f); | ||
} | ||
return false; | ||
} |
{ | ||
"name": "extension-props", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
63396
1720
0