@prostojs/mate 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mate.cjs.prod.js
CHANGED
package/dist/mate.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export declare function getConstructor<T = TObject>(instance: T): TFunction;
|
|
2
|
+
|
|
3
|
+
export declare function isConstructor<T = TAny>(v: T): v is T & TClassConstructor;
|
|
4
|
+
|
|
1
5
|
export declare class Mate<T extends TProstoMetadata = TProstoMetadata> {
|
|
2
6
|
protected workspace: string;
|
|
3
7
|
constructor(workspace: string);
|
|
@@ -13,6 +17,8 @@ export declare class Mate<T extends TProstoMetadata = TProstoMetadata> {
|
|
|
13
17
|
|
|
14
18
|
declare type TAny = any;
|
|
15
19
|
|
|
20
|
+
declare type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
|
|
21
|
+
|
|
16
22
|
declare type TFunction = Function;
|
|
17
23
|
|
|
18
24
|
export declare interface TMergedDecoratorArgs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){console.error(`[91m[1m[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `+e+"[0m")}function t(e){return"function"==typeof e&&Object.getOwnPropertyNames(e).includes("prototype")&&!Object.getOwnPropertyNames(e).includes("caller")&&!!e.name}require("reflect-metadata");class
|
|
1
|
+
function e(e){console.error(`[91m[1m[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `+e+"[0m")}function t(e){return Object.getPrototypeOf(e).constructor}function r(e){return"function"==typeof e&&Object.getOwnPropertyNames(e).includes("prototype")&&!Object.getOwnPropertyNames(e).includes("caller")&&!!e.name}require("reflect-metadata");class a{constructor(e){this.workspace=e}set(t,r,a,o){var p;let n=Reflect.getMetadata(this.workspace,t.target,t.propKey)||{};const{index:s}=t,c="function"==typeof r?r:void 0;let i=n;if(i.params||(i.params=null===(p=Reflect.getMetadata("design:paramtypes",t.target,t.propKey))||void 0===p?void 0:p.map((e=>({type:e})))),"number"==typeof s&&(i.params=i.params||[],i.params[s]=i.params[s]||{type:void 0},c?i.params[s]=c(i.params[s]):i=i.params[s]),"function"!=typeof r)if(o){const t=i[r]||[];Array.isArray(t)||(e(f="Mate.add (isArray=true) called for non-array metadata"),new Error(f)),t.unshift(a),i[r]=t}else i[r]=a;else c&&"number"!=typeof s&&(n=c(i));var f;Reflect.defineMetadata(this.workspace,n,t.target,t.propKey)}read(e,a){return Reflect.getMetadata(this.workspace,"string"==typeof a?r(e)?e.prototype:e:r(e)?e:t(e),a)}apply(...e){return(t,r,a)=>{for(const o of e)o(t,r,a)}}decorate(e,t,r){return(a,o,p)=>{this.set({target:a,propKey:o,descriptor:"number"==typeof p?void 0:p,index:"number"==typeof p?p:void 0},e,t,r)}}}export{a as Mate,t as getConstructor,r as isConstructor};
|
package/dist/mate.esm-bundler.js
CHANGED
package/dist/mate.global.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ProstoMate=function(e){"use strict";function t(e){console.error(`[91m[1m[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `+e+"[0m")}function r(e){return"function"==typeof e&&Object.getOwnPropertyNames(e).includes("prototype")&&!Object.getOwnPropertyNames(e).includes("caller")&&!!e.name}require("reflect-metadata");return e.Mate=class{constructor(e){this.workspace=e}set(e,r,a,o){var
|
|
1
|
+
var ProstoMate=function(e){"use strict";function t(e){console.error(`[91m[1m[prostojs/mate][${(new Date).toISOString().replace("T"," ").replace(/\.\d{3}z$/i,"")}] `+e+"[0m")}function r(e){return Object.getPrototypeOf(e).constructor}function a(e){return"function"==typeof e&&Object.getOwnPropertyNames(e).includes("prototype")&&!Object.getOwnPropertyNames(e).includes("caller")&&!!e.name}require("reflect-metadata");return e.Mate=class{constructor(e){this.workspace=e}set(e,r,a,o){var n;let s=Reflect.getMetadata(this.workspace,e.target,e.propKey)||{};const{index:p}=e,c="function"==typeof r?r:void 0;let i=s;if(i.params||(i.params=null===(n=Reflect.getMetadata("design:paramtypes",e.target,e.propKey))||void 0===n?void 0:n.map((e=>({type:e})))),"number"==typeof p&&(i.params=i.params||[],i.params[p]=i.params[p]||{type:void 0},c?i.params[p]=c(i.params[p]):i=i.params[p]),"function"!=typeof r)if(o){const e=i[r]||[];Array.isArray(e)||(t(u="Mate.add (isArray=true) called for non-array metadata"),new Error(u)),e.unshift(a),i[r]=e}else i[r]=a;else c&&"number"!=typeof p&&(s=c(i));var u;Reflect.defineMetadata(this.workspace,s,e.target,e.propKey)}read(e,t){return Reflect.getMetadata(this.workspace,"string"==typeof t?a(e)?e.prototype:e:a(e)?e:r(e),t)}apply(...e){return(t,r,a)=>{for(const o of e)o(t,r,a)}}decorate(e,t,r){return(a,o,n)=>{this.set({target:a,propKey:o,descriptor:"number"==typeof n?void 0:n,index:"number"==typeof n?n:void 0},e,t,r)}}},e.getConstructor=r,e.isConstructor=a,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA"}
|