@cpchain-tools/realm-property-babel-plugin

0.0.2 • Public • Published

realm-property-babel-plugin

Expand Enum type and BigNumber type for @ realm/label plugin

Usage

enum TestType {
  CPChain = 1,
  Ethereum,
}

class TestObject extends Realm.Object {
  readonly _id = new Realm.BSON.ObjectId();
  @RealmEnum
  type!: TestType;
  @RealmBigNumber
  balance!: BigNumber;
  description!: string;
  static primaryKey = '_id';
  constructor(
    realm: Realm,
    {
      type,
      description,
      balance,
    }: {
      type: TestType;
      description: string;
      balance: BigNumber;
    },
  ) {
    super(realm, {
      _type: type,
      _balance: balance.toHexString(),
      description,
    });
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @cpchain-tools/realm-property-babel-plugin

Weekly Downloads

0

Version

0.0.2

License

ISC

Unpacked Size

4.48 kB

Total Files

3

Last publish

Collaborators

  • zhangkai-cpchain
  • cpchain_tech