• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    JavaScript
  • Created over 9 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tiny API wrapper for localStorage

ASTORAGE

A tiny API wrapper for localStorage that lets you safely save numbers, arrays, objects and other data types.

Installation

Astorage is available via npm or bower.

npm install astorage

or

bower install astorage

Otherwise you can directly download zip.

Usage and API

// define some data
var users = [
  {
    name: 'John Doe',
    age: 21
  },
  {
    name: 'Alex Smith',
    age: 35
  }
];

// save data into localStorage.
// API: astorage.set(key, value)
// key — string
// value — string, number, array, object or anything else
astorage.set('users', users); 

// get value from localStorage by key.
// API: astorage.get(key)
// key — string
astorage.get('users');
> [{name: 'John Doe', age: 21}, {name: 'Alex Smith', age: 35}]

// remove item from localStorage
astorage.remove('users');

// or empty localStorage
astorage.clear();

// get localStorage items count
astorage.length
> 0

LICENSE

Released under the MIT license.

The MIT License (MIT)

Copyright © 2015 Andrew Romanov, Kiril Osiyuk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

More Repositories

1

frontend-case-studies

💼 A curated list of technical talks and articles about real world enterprise frontend development
7,016
star
2

channels

📺 A collection of useful YouTube channels for javascript developers and web designers
4,280
star
3

the-little-book-on-coffeescript

Перевод на русский книги «The Little Book on CoffeeScript».
166
star
4

frontendbookshelf

Книжная полка фронтендера
JavaScript
64
star
5

puretabs

Простые табы на чистом JavaScript.
HTML
41
star
6

smacss

Перевод smacss.com
37
star
7

breakpoint

A tiny API wrapper around window.matchMedia
JavaScript
35
star
8

databinder

A small and pretty simple tool for data binding.
JavaScript
27
star
9

startanul

Стартовый шаблон для вёрстки
CSS
26
star
10

utransition

A tiny (~2KB) library providing you an easy way to manage time-based transitions
JavaScript
23
star
11

stylus-utilities

Набор полезных Stylus-миксинов.
CSS
12
star
12

hljs-alabaster

Alabaster theme for Highlight.js
HTML
12
star
13

forweb.dev

Nunjucks
9
star
14

madewithlove-landing

Landing page for sticker.place
CSS
8
star
15

osx-setup

Initial OS X setup
Shell
6
star
16

yandex-second

Тестовое задание для поступления в ШРИ Яндекса
JavaScript
5
star
17

js-helpers

JavaScript
4
star
18

pseudohover

Highlight on hover all links with the same href
JavaScript
4
star
19

sicp

My solutions of SICP exercises
Racket
3
star
20

personal-website

http://andreyromanov.com, http://andrew-r.ru
Nunjucks
3
star
21

clickjs

A lightweight tool for really powerful clicking on links.
JavaScript
3
star
22

dotfiles

Vim Script
2
star
23

frontendbookshelf-data

Данные для «Книжной полки фронтендера»
JavaScript
2
star
24

fuckingwebsite.ru

HTML
2
star
25

sum-strings

JavaScript
1
star
26

foreign-exchange-widget

JavaScript
1
star
27

rambler-adtech-ui-kit

JavaScript
1
star
28

andrew-r.ru

Personal site
HTML
1
star
29

f-words

Феминитивы
HTML
1
star
30

react-boilerplate

JavaScript
1
star
31

fit-to-area

JavaScript
1
star
32

stream-adventures-solutions

JavaScript
1
star
33

static-website-template

JavaScript
1
star
34

react-redux-employees-list

Тестовое задание на должность фронтенд-разработчика
JavaScript
1
star
35

sharec-config

JavaScript
1
star
36

js-library-boilerplate

JavaScript
1
star
37

exercism

My solutions to the Exercism tasks
F#
1
star