versioned-object

1.0.3 • Public • Published

Versioned Object

Example

// Make sure to *NEVER* change an existing migration that is used in production. Always add new migrations.
const migrator = Migration.BaseMigration.addMigration(1, (v) => {
  return {
    /** always increment this */
    version: 1,
    bestCat: "unknown",
  };
})
  .addMigration(2, (v) => {
    return {
      version: 2,
      bestCat: v.bestCat === "unknown" ? "Meow" : v.bestCat,
    };
  })
  .build();

migrator.migrateToLatest({ version: 0 });

Readme

Keywords

none

Package Sidebar

Install

npm i versioned-object

Weekly Downloads

0

Version

1.0.3

License

BSD-3-Clause

Unpacked Size

5.27 kB

Total Files

5

Last publish

Collaborators

  • stefnotch