3.0.0 • Published 7 months ago

backup-manager v3.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Backup manager

This simple module simplifies working with localStorage by creating backups and saving them to localStorage.

The module is designed to save data collections to localStorage, load and change collection elements in localStorage.

The module exports the Backup class. When creating a new backup, you need to create a new instance of this class with the arguments: data, id. data is the argument to which the new backup data is written. id is the backup identifier.

Backup class instance methods: 1. save(collection) - saves the backup to the specified collection. (If the collection is missing, a new one is created with the same name) 2. replace(collection, id) - replaces the backup with the specified identifier in the specified collection with a new one. 3. getData() - returns the backup data. 4. getId() - returns the backup identifier. 5. setData(data) - sets the backup to the specified data. 6. setId(id) - sets the backup to the specified identifier.

Static methods of the Backup class: 1. load(collection, id) - returns a backup from the specified collection, with the specified identifier. 2. contains(collection, id) - returns a logical value: whether the backup with the specified identifier is contained in the specified collection. 3. setDataInCollection(collection, id, data) - sets the backup from the specified collection, with the specified identifier, to new data. 4. setIdInCollection(collection, id, newId) - sets the backup from the specified collection, with the specified identifier, to a new identifier. 5. getIdFromData(collection, data) - returns the identifier of the backup from the specified collection, with the specified data. 6. containsCollection(collection) - returns a logical value: whether this collection exists. 7. remove(collection, id) - removes a backup from the specified collection, with the specified id. 8. getCollection(collection) - returns the specified collection. 9. setCollection(collection, data) - manually sets the specified collection, the specified data. 10. removeCollection(collection) - removes the specified collection.

3.0.0

7 months ago

2.0.0

7 months ago

1.1.1

4 years ago

1.0.2

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.1.2

4 years ago

1.0.3

4 years ago

0.6.8

7 years ago

0.6.7

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.2.1

5 years ago