@vmojs/decorator
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

@vmojs/decorator

Using TypeScript MIT License

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"
 * }
 * 
 * */

Readme

Keywords

none

Package Sidebar

Install

npm i @vmojs/decorator

Weekly Downloads

0

Version

2.0.4

License

ISC

Unpacked Size

44.1 kB

Total Files

30

Last publish

Collaborators

  • xiaobe