<commit_before>storage-backed-object [![Build Status](https://api.travis-ci.org/intelligentgolf/storage-backed-object.png?branch=master)](https://travis-ci.org/intelligentgolf/storage-backed-object)
=====================

Simple AngularJS service to store an object of key/values in HTML5 storage. This can be useful when wanting to store complex data that survives browser refreshes.

Usage
-----
   
    // Create the object
    var users = StorageBackedObject('users');
    
    // Store an item by key
    users.set(1234, {name: '<NAME>'})
    
    // Fetch an item by key
    var user = users.get('1234');
    
    // Remove an item by key
    users.remove(1234);
    

Properties
----------

Repeated calls to `get` returns the exact same value.

	users.set(1234, {name: '<NAME>'});
    users.get(1234) === users.get(1234); // True
    
This makes it safe to repeatedly call `get` for the same key, without using more memory.
    
    
Under the hood
--------------<commit_msg>Show example of injecting StorageBackedObject into a service<commit_after>storage-backed-object [![Build Status](https://api.travis-ci.org/intelligentgolf/storage-backed-object.png?branch=master)](https://travis-ci.org/intelligentgolf/storage-backed-object)
=====================

Simple AngularJS service to store an object of key/values in HTML5 storage. This can be useful when wanting to store complex data that survives browser refreshes.

Usage
-----

Add the dependency to your AngularJS app:

    // Add module dependency 
    angular.module('myApp', ['storage-backed-object']);
    
Then use it by injecting `StorageBackedObject` into your services:
       
    angular.service('MyService', function(StorageBackedObject) {
      // Create the object
      var users = StorageBackedObject('users');
    
      // Store an item by key
      users.set(1234, {name: '<NAME>'})
    
      // Fetch an item by key
      var user = users.get('1234');
    
      // Remove an item by key
      users.remove(1234);
    });    
  

Properties
----------

Repeated calls to `get` returns the exact same value.

	users.set(1234, {name: '<NAME>'});
    users.get(1234) === users.get(1234); // True
    
This makes it safe to repeatedly call `get` for the same key, without using more memory.
    
    
Under the hood
--------------
{'fraction_non_alphanumeric': 0.14805194805194805, 'fraction_numerical': 0.021645021645021644, 'mean_word_length': 2.87751677852349, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6284237', 'n_tokens_mistral': 707, 'n_tokens_neox': 646, 'n_words': 216}