An open API service indexing awesome lists of open source software.

https://github.com/stefnotch/versioned-object

A simple JSON versioning schema with a fluent interface for adding migrations
https://github.com/stefnotch/versioned-object

Last synced: 4 days ago
JSON representation

A simple JSON versioning schema with a fluent interface for adding migrations

Awesome Lists containing this project

README

          

# Versioned Object

Example

```ts
// 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 });
```