Compare commits
3 Commits
v1.0.1
...
local-stor
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c3ac848f2 | |||
|
|
67a22d36a1 | ||
| b5717e42b2 |
41
LICENSE
Normal file
41
LICENSE
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
Copyright 2011 AJ ONeal
|
||||||
|
|
||||||
|
This is open source software; you can redistribute it and/or modify it under the
|
||||||
|
terms of either:
|
||||||
|
|
||||||
|
a) the "MIT License"
|
||||||
|
b) the "Apache-2.0 License"
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Apache-2.0 License Summary
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
21
README.md
21
README.md
@ -1,15 +1,16 @@
|
|||||||
localStorage
|
# DOMStorage
|
||||||
===
|
|
||||||
|
See https://git.coolaj86.com/coolaj86/dom-storage.js for a slightly better version of the same thing.
|
||||||
|
|
||||||
|
# localStorage
|
||||||
|
|
||||||
An inefficient, but as W3C-compliant as possible using only pure JavaScript, `localStorage` implementation.
|
An inefficient, but as W3C-compliant as possible using only pure JavaScript, `localStorage` implementation.
|
||||||
|
|
||||||
Purpose
|
## Purpose
|
||||||
----
|
|
||||||
|
|
||||||
This is meant for the purpose of being able to run unit-tests and such for browser-y modules in node.
|
This is meant for the purpose of being able to run unit-tests and such for browser-y modules in node.
|
||||||
|
|
||||||
Usage
|
## Usage
|
||||||
----
|
|
||||||
|
|
||||||
var localStorage = require('localStorage')
|
var localStorage = require('localStorage')
|
||||||
, myValue = { foo: 'bar', baz: 'quux' }
|
, myValue = { foo: 'bar', baz: 'quux' }
|
||||||
@ -18,8 +19,7 @@ Usage
|
|||||||
localStorage.setItem('myKey', JSON.stringify(myValue));
|
localStorage.setItem('myKey', JSON.stringify(myValue));
|
||||||
myValue = localStorage.getItem('myKey');
|
myValue = localStorage.getItem('myKey');
|
||||||
|
|
||||||
API
|
## API
|
||||||
---
|
|
||||||
|
|
||||||
* getItem(key)
|
* getItem(key)
|
||||||
* setItem(key, value)
|
* setItem(key, value)
|
||||||
@ -28,8 +28,9 @@ API
|
|||||||
* key(n)
|
* key(n)
|
||||||
* length
|
* length
|
||||||
|
|
||||||
Tests
|
## Tests
|
||||||
---
|
|
||||||
|
null === localStorage.getItem('key');
|
||||||
|
|
||||||
0 === localStorage.length;
|
0 === localStorage.length;
|
||||||
null === localStorage.getItem('doesn't exist');
|
null === localStorage.getItem('doesn't exist');
|
||||||
|
|||||||
@ -2,15 +2,17 @@
|
|||||||
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.info)",
|
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.info)",
|
||||||
"name": "localStorage",
|
"name": "localStorage",
|
||||||
"description": "W3C localStorage for Node.JS",
|
"description": "W3C localStorage for Node.JS",
|
||||||
"version": "1.0.1",
|
"homepage": "https://git.coolaj86.com/coolaj86/local-storage.js",
|
||||||
|
"version": "1.0.4",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/coolaj86/node-localStorage.git"
|
"url": "https://git.coolaj86.com/coolaj86/local-storage.js.git"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= v0.2.0"
|
"node": ">= v0.2.0"
|
||||||
},
|
},
|
||||||
"main": "localStorage.js",
|
"main": "./lib/localStorage.js",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {}
|
"devDependencies": {},
|
||||||
|
"license": "(MIT OR Apache-2.0)"
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user