realm-property-babel-plugin

1.0.0 • 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 realm-property-babel-plugin

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

4.16 kB

Total Files

3

Last publish

Collaborators

  • zhangkai-cpchain