@vmojs/decorator
v2.0.4
Published
Vmo is a data model for the front end. A micro-framework that solves the confusion of front-end interface access, inconsistent data request methods on the server side, and inconsistent data return results.
Downloads
14
Readme
@vmojs/decorator
Usage example
import { Vmo } from "@vmojs/decorator";
@Vmo()
export class PageParams {
constructor(data: any) {}
@Vmo()
type?: string;
// subType2 => subType
@Vmo("subType2")
subType?: string;
@Vmo(({ type, subType }) => `${type}_${subType}`)
finalType?: string;
}
new PageParams({ type: "Type1", subType2: "SubType" });
/**
* =>
*
* {
* type: "Type1",
* subType: "SubType",
* finalType: "Type1_SubType"
* }
*
* */