@scalecube/utils
Advanced tools
Comparing version 0.0.2-snapshot.1565182903.6 to 0.0.2-snapshot.1565528584.2
@@ -19,4 +19,6 @@ declare type Collection<T> = T[] | { | ||
export declare const isFunction: (val: any) => boolean; | ||
export declare const isFunctionConstructor: (val: any) => boolean; | ||
export declare const assertFunction: (val: any, msg?: string) => void; | ||
export declare const assertClass: (val: any, msg?: string) => void; | ||
export declare const assertNumber: (val: any, msg?: string) => void; | ||
export {}; |
@@ -50,3 +50,8 @@ var assert = function (predicate, msg) { | ||
}; | ||
var isFunction = function (val) { return typeof val === 'function'; }; | ||
var isFunction = function (val) { | ||
return typeof val === 'function' && !/^class\s/.test(Function.prototype.toString.call(val)); | ||
}; | ||
var isFunctionConstructor = function (val) { | ||
return typeof val === 'function' && /^class\s/.test(Function.prototype.toString.call(val)); | ||
}; | ||
var assertFunction = function (val, msg) { | ||
@@ -56,2 +61,6 @@ if (msg === void 0) { msg = 'Expected to be a function'; } | ||
}; | ||
var assertClass = function (val, msg) { | ||
if (msg === void 0) { msg = 'Expected to be a class'; } | ||
assert(isFunctionConstructor(val), msg); | ||
}; | ||
var assertNumber = function (val, msg) { | ||
@@ -78,3 +87,5 @@ if (msg === void 0) { msg = 'Expected to be a number'; } | ||
isFunction: isFunction, | ||
isFunctionConstructor: isFunctionConstructor, | ||
assertFunction: assertFunction, | ||
assertClass: assertClass, | ||
assertNumber: assertNumber | ||
@@ -81,0 +92,0 @@ }); |
@@ -19,4 +19,6 @@ declare type Collection<T> = T[] | { | ||
export declare const isFunction: (val: any) => boolean; | ||
export declare const isFunctionConstructor: (val: any) => boolean; | ||
export declare const assertFunction: (val: any, msg?: string) => void; | ||
export declare const assertClass: (val: any, msg?: string) => void; | ||
export declare const assertNumber: (val: any, msg?: string) => void; | ||
export {}; |
@@ -54,3 +54,8 @@ 'use strict'; | ||
}; | ||
var isFunction = function (val) { return typeof val === 'function'; }; | ||
var isFunction = function (val) { | ||
return typeof val === 'function' && !/^class\s/.test(Function.prototype.toString.call(val)); | ||
}; | ||
var isFunctionConstructor = function (val) { | ||
return typeof val === 'function' && /^class\s/.test(Function.prototype.toString.call(val)); | ||
}; | ||
var assertFunction = function (val, msg) { | ||
@@ -60,2 +65,6 @@ if (msg === void 0) { msg = 'Expected to be a function'; } | ||
}; | ||
var assertClass = function (val, msg) { | ||
if (msg === void 0) { msg = 'Expected to be a class'; } | ||
assert(isFunctionConstructor(val), msg); | ||
}; | ||
var assertNumber = function (val, msg) { | ||
@@ -82,3 +91,5 @@ if (msg === void 0) { msg = 'Expected to be a number'; } | ||
isFunction: isFunction, | ||
isFunctionConstructor: isFunctionConstructor, | ||
assertFunction: assertFunction, | ||
assertClass: assertClass, | ||
assertNumber: assertNumber | ||
@@ -85,0 +96,0 @@ }); |
{ | ||
"name": "@scalecube/utils", | ||
"version": "0.0.2-snapshot.1565182903.6+f2519be", | ||
"version": "0.0.2-snapshot.1565528584.2+01f7c6f", | ||
"private": false, | ||
@@ -38,5 +38,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@scalecube/api": "^0.0.2-snapshot.1565182903.6+f2519be" | ||
"@scalecube/api": "^0.0.2-snapshot.1565528584.2+01f7c6f" | ||
}, | ||
"gitHead": "f2519bef1345a6600fe69fc5cf0d2c2fc77cadc1" | ||
"gitHead": "01f7c6fde36ff738b07fb63345feed37706cf74d" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
44726
701