appolo-utils
Advanced tools
Comparing version 0.0.41 to 0.0.42
@@ -28,7 +28,9 @@ "use strict"; | ||
exports.Functions = functions_1.Functions; | ||
const errors_1 = require("./lib/errors"); | ||
exports.Errors = errors_1.Errors; | ||
const util_1 = require("./lib/util"); | ||
exports.Util = util_1.Util; | ||
const reflectMetadata_1 = require("./lib/reflectMetadata"); | ||
exports.ReflectMetadata = reflectMetadata_1.ReflectMetadata; | ||
const reflector_1 = require("./lib/reflector"); | ||
exports.Reflector = reflector_1.Reflector; | ||
exports.default = util_1.Util; | ||
//# sourceMappingURL=index.js.map |
@@ -13,4 +13,5 @@ import {Numbers} from "./lib/numbers" | ||
import {Functions} from "./lib/functions" | ||
import {Errors} from "./lib/errors" | ||
import {Util} from "./lib/util" | ||
import {ReflectMetadata} from "./lib/reflectMetadata" | ||
import {Reflector} from "./lib/reflector" | ||
@@ -33,5 +34,5 @@ export default Util; | ||
Deferred, | ||
ReflectMetadata, Functions | ||
Reflector, Functions, Errors | ||
} | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const arrays_1 = require("./arrays"); | ||
const index_1 = require("../index"); | ||
class Classes { | ||
@@ -9,3 +10,3 @@ static isClass(v) { | ||
static isFunction(obj) { | ||
return !!(obj && obj.constructor && obj.call && obj.apply); | ||
return index_1.Functions.isFunction(obj); | ||
} | ||
@@ -12,0 +13,0 @@ ; |
import {Arrays} from "./arrays"; | ||
import {Functions} from "../index"; | ||
@@ -9,3 +10,3 @@ export class Classes { | ||
public static isFunction(obj: any): boolean { | ||
return !!(obj && obj.constructor && obj.call && obj.apply); | ||
return Functions.isFunction(obj); | ||
}; | ||
@@ -17,3 +18,3 @@ | ||
public static functionArgsNames(func: ((...args: any[]) => any) | (new(...args: any[])=> any)) { | ||
public static functionArgsNames(func: ((...args: any[]) => any) | (new(...args: any[]) => any)) { | ||
@@ -20,0 +21,0 @@ const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const arrays_1 = require("./arrays"); | ||
class Functions { | ||
@@ -42,4 +43,17 @@ static memoize(fn, resolver) { | ||
} | ||
static isFunction(obj) { | ||
return !!(obj && obj.constructor && obj.call && obj.apply); | ||
} | ||
; | ||
static mixins(_klass, mixins) { | ||
arrays_1.Arrays.arrayify(mixins).forEach(mixin => { | ||
Object.getOwnPropertyNames(mixin.prototype).forEach((name) => { | ||
if (["constructor"].indexOf(name) == -1) { | ||
_klass.prototype[name] = mixin.prototype[name]; | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
exports.Functions = Functions; | ||
//# sourceMappingURL=functions.js.map |
@@ -0,1 +1,3 @@ | ||
import {Arrays} from "./arrays"; | ||
export class Functions { | ||
@@ -51,2 +53,19 @@ public static memoize(fn: Function, resolver?: (args?: any[]) => string | number) { | ||
} | ||
public static isFunction(obj: any): boolean { | ||
return !!(obj && obj.constructor && obj.call && obj.apply); | ||
}; | ||
public static mixins(_klass: Function, mixins: Function | Function[]) { | ||
Arrays.arrayify<Function>(mixins).forEach(mixin => { | ||
Object.getOwnPropertyNames(mixin.prototype).forEach((name) => { | ||
if (["constructor"].indexOf(name) == -1) { | ||
_klass.prototype[name] = mixin.prototype[name] | ||
} | ||
}) | ||
}); | ||
} | ||
} |
@@ -14,4 +14,5 @@ "use strict"; | ||
const enums_1 = require("./enums"); | ||
const ReflectMetadata_1 = require("./ReflectMetadata"); | ||
const reflector_1 = require("./reflector"); | ||
const functions_1 = require("./functions"); | ||
const errors_1 = require("./errors"); | ||
class Util { | ||
@@ -54,7 +55,10 @@ static get numbers() { | ||
} | ||
static get Metadata() { | ||
return ReflectMetadata_1.ReflectMetadata; | ||
static get Reflector() { | ||
return reflector_1.Reflector; | ||
} | ||
static get errors() { | ||
return errors_1.Errors; | ||
} | ||
} | ||
exports.Util = Util; | ||
//# sourceMappingURL=util.js.map |
@@ -12,4 +12,5 @@ import {Numbers} from "./numbers"; | ||
import {Enums} from "./enums"; | ||
import {ReflectMetadata} from "./ReflectMetadata"; | ||
import {Reflector} from "./reflector"; | ||
import {Functions} from "./functions"; | ||
import {Errors} from "./errors"; | ||
@@ -65,5 +66,8 @@ export class Util { | ||
public static get Metadata(): typeof ReflectMetadata{ | ||
return ReflectMetadata | ||
public static get Reflector(): typeof Reflector{ | ||
return Reflector | ||
} | ||
public static get errors(): typeof Errors{ | ||
return Errors | ||
} | ||
} |
@@ -17,3 +17,3 @@ { | ||
"main": "./index.js", | ||
"version": "0.0.41", | ||
"version": "0.0.42", | ||
"license": "MIT", | ||
@@ -20,0 +20,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
97336
50
1763