0.0.2 • Published 1 year ago

@cpchain-tools/realm-property-babel-plugin v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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,
    });
  }
}
0.0.2

1 year ago

0.0.1

1 year ago