1.2.1 • Published 2 years ago

storelify v1.2.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

storelify

Storelify is a front-end package that help you to storage all data into one localStorage object in order to keep things tidy.

Storelify stores properties in the _namespace object in order to keep things tidy. When you set/get/remove/clearAll a property you only have to specify the property name (and value if you are using the set function), and the service will automatically add it to the _namespace local storage object. It will create the object if it is not yet created.

Before:

After:

Usage

npm i -S storelify

Now, you should be able to use Storelify in your components.

Example:

import { Storelify } from "storelify";

// Don't forget to pass an env variable name where all properties will be saved, on initialization.
const storelify = new Storelify("__fmb_dev");

storelify.set("__enable_mock", true);
console.log("Is mock enabled?", storelify.get("__enable_mock")); // true

Avalaiable methods:

class Storelify {
  set(key: string, value: PropertyValue): void;
  get(key: string): PropertyValue | undefined;
  remove(key: string): void;
  clearAll(): void;
  size(): number;
  keys(): string[];
  has(key: string): boolean;
}

More detalied documentation here

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago