session-cache
Advanced tools
Comparing version 0.1.3 to 0.2.0
19
index.js
/*! | ||
* session-cache <https://github.com/doowb/session-cache> | ||
* | ||
* Copyright (c) 2014 Brian Woodward | ||
* Licensed under the MIT license. | ||
* Copyright (c) 2014-2015, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
@@ -38,2 +38,5 @@ | ||
var session = storage.get(name) || storage.create(name); | ||
var res = { | ||
name: session.name | ||
}; | ||
@@ -64,3 +67,3 @@ /** | ||
exports.run = session.run.bind(session); | ||
res.run = session.run.bind(session); | ||
@@ -81,3 +84,3 @@ /** | ||
exports.bind = session.bind.bind(session); | ||
res.bind = session.bind.bind(session); | ||
@@ -96,3 +99,3 @@ /** | ||
exports.bindEmitter = session.bindEmitter.bind(session); | ||
res.bindEmitter = session.bindEmitter.bind(session); | ||
@@ -108,3 +111,3 @@ /** | ||
exports.set = function set(key, value) { | ||
res.set = function set(key, value) { | ||
if (isActive()) { | ||
@@ -124,3 +127,3 @@ return session.set(key, value); | ||
exports.get = function get(key) { | ||
res.get = function get(key) { | ||
if (isActive()) { | ||
@@ -132,3 +135,3 @@ return session.get(key); | ||
return exports; | ||
return res; | ||
}; |
{ | ||
"name": "session-cache", | ||
"description": "Session storage for tasks.", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/doowb/session-cache", | ||
@@ -17,7 +17,6 @@ "author": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/doowb/session-cache/blob/master/LICENSE-MIT" | ||
} | ||
"license": "MIT", | ||
"files": [ | ||
"index.js", | ||
"lib/" | ||
], | ||
@@ -29,4 +28,7 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"continuation-local-storage": "^3.1.1" | ||
}, | ||
"devDependencies": { | ||
@@ -36,5 +38,6 @@ "mocha": "*", | ||
}, | ||
"dependencies": { | ||
"continuation-local-storage": "^3.1.1" | ||
} | ||
"file": [ | ||
"index.js", | ||
"lib/" | ||
] | ||
} |
@@ -1,6 +0,5 @@ | ||
# session-cache [![NPM version](https://badge.fury.io/js/session-cache.svg)](http://badge.fury.io/js/session-cache) | ||
# session-cache [![NPM version](https://badge.fury.io/js/session-cache.svg)](http://badge.fury.io/js/session-cache) [![Build Status](https://travis-ci.org/doowb/session-cache.svg)](https://travis-ci.org/doowb/session-cache) | ||
> Session storage for tasks. | ||
## Install | ||
## Install with [npm](npmjs.org) | ||
@@ -12,8 +11,10 @@ | ||
## Run tests | ||
## Running tests | ||
Install dev dependencies. | ||
```bash | ||
npm test | ||
npm i -d && npm test | ||
``` | ||
## Usage | ||
@@ -28,3 +29,3 @@ | ||
## API | ||
### [.createSession](index.js#L36) | ||
### [.createSession](./index.js#L36) | ||
@@ -40,3 +41,3 @@ Create a session with the given `name` | ||
### [.bind](index.js#L79) | ||
### [.bind](./index.js#L82) | ||
@@ -54,3 +55,3 @@ Bind a function to the current Session context. | ||
### [.bindEmitter](index.js#L93) | ||
### [.bindEmitter](./index.js#L96) | ||
@@ -66,3 +67,3 @@ Bind an EventEmitter or Stream to the current Session context. | ||
### [.set](index.js#L104) | ||
### [.set](./index.js#L107) | ||
@@ -75,3 +76,3 @@ * `key` **{String}** | ||
### [.get](index.js#L119) | ||
### [.get](./index.js#L122) | ||
@@ -94,3 +95,3 @@ * `key` **{String}** | ||
## License | ||
Copyright (c) 2014 Brian Woodward | ||
Copyright © 2015 Brian Woodward | ||
Released under the MIT license | ||
@@ -100,2 +101,2 @@ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on December 16, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 25, 2015._ |
131
95
6802
6