diff options
Diffstat (limited to 'node_modules/continuable-cache')
-rw-r--r-- | node_modules/continuable-cache/.jshintrc | 42 | ||||
-rw-r--r-- | node_modules/continuable-cache/.npmignore | 15 | ||||
-rw-r--r-- | node_modules/continuable-cache/.testem.json | 14 | ||||
-rw-r--r-- | node_modules/continuable-cache/.travis.yml | 6 | ||||
-rw-r--r-- | node_modules/continuable-cache/LICENCE | 19 | ||||
-rw-r--r-- | node_modules/continuable-cache/README.md | 48 | ||||
-rw-r--r-- | node_modules/continuable-cache/index.js | 29 | ||||
-rw-r--r-- | node_modules/continuable-cache/package.json | 50 | ||||
-rw-r--r-- | node_modules/continuable-cache/test/index.js | 8 |
9 files changed, 231 insertions, 0 deletions
diff --git a/node_modules/continuable-cache/.jshintrc b/node_modules/continuable-cache/.jshintrc new file mode 100644 index 0000000..30a2d72 --- /dev/null +++ b/node_modules/continuable-cache/.jshintrc @@ -0,0 +1,42 @@ +{ + "asi": true, + + "bitwise": false, + "camelcase": true, + "curly": false, + "eqeqeq": true, + "forin": true, + "immed": true, + "indent": 4, + "latedef": false, + "newcap": true, + "noarg": true, + "nonew": true, + "plusplus": false, + "quotmark": false, + "regexp": false, + "undef": true, + "unused": true, + "strict": false, + "trailing": true, + "noempty": true, + "maxdepth": 4, + "maxparams": 4, + + "globals": { + "console": true, + "Buffer": true, + "setTimeout": true, + "clearTimeout": true, + "setInterval": true, + "clearInterval": true, + "require": false, + "module": false, + "exports": true, + "global": false, + "process": true, + "__dirname": false, + "__filename": false + }, + "node": false +} diff --git a/node_modules/continuable-cache/.npmignore b/node_modules/continuable-cache/.npmignore new file mode 100644 index 0000000..fd31f5e --- /dev/null +++ b/node_modules/continuable-cache/.npmignore @@ -0,0 +1,15 @@ +.DS_Store +.monitor +.*.swp +.nodemonignore +releases +*.log +*.err +fleet.json +public/browserify +bin/*.json +.bin +build +compile +.lock-wscript +node_modules diff --git a/node_modules/continuable-cache/.testem.json b/node_modules/continuable-cache/.testem.json new file mode 100644 index 0000000..41ab90e --- /dev/null +++ b/node_modules/continuable-cache/.testem.json @@ -0,0 +1,14 @@ +{ + "launchers": { + "node": { + "command": "node ./test" + } + }, + "src_files": [ + "./**/*.js" + ], + "before_tests": "npm run build-test", + "on_exit": "rm test/static/bundle.js", + "test_page": "test/static/index.html", + "launch_in_dev": ["node", "phantomjs"] +} diff --git a/node_modules/continuable-cache/.travis.yml b/node_modules/continuable-cache/.travis.yml new file mode 100644 index 0000000..52424f8 --- /dev/null +++ b/node_modules/continuable-cache/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - 0.8 + - 0.9 + - 0.10 +script: node ./test/index.js diff --git a/node_modules/continuable-cache/LICENCE b/node_modules/continuable-cache/LICENCE new file mode 100644 index 0000000..72d356c --- /dev/null +++ b/node_modules/continuable-cache/LICENCE @@ -0,0 +1,19 @@ +Copyright (c) 2013 Colingo. + +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. diff --git a/node_modules/continuable-cache/README.md b/node_modules/continuable-cache/README.md new file mode 100644 index 0000000..2702722 --- /dev/null +++ b/node_modules/continuable-cache/README.md @@ -0,0 +1,48 @@ +# continuable-cache + +<!-- [![build status][1]][2] [![dependency status][3]][4] + +[![browser support][5]][6] --> + +Cache a continuable + +## Example + +```js +var cache = require("continuable-cache") +var fs = require("fs") + +var readFile = function (uri) { return function (cb) { + fs.readFile(uri, cb) +} } + +var continuableFile = readFile("./package.json") + +var cached = cache(continuableFile) + +// will only do one file read operation +cached(function (err, file) { + /* calls out to fs.readFile */ +}) + +cached(function (err, file) { + /* get's either err or file from cache in cached */ +}) +``` + +## Installation + +`npm install continuable-cache` + +## Contributors + + - Raynos + +## MIT Licenced + + [1]: https://secure.travis-ci.org/Raynos/continuable-cache.png + [2]: http://travis-ci.org/Raynos/continuable-cache + [3]: https://david-dm.org/Raynos/continuable-cache/status.png + [4]: https://david-dm.org/Raynos/continuable-cache + [5]: https://ci.testling.com/Raynos/continuable-cache.png + [6]: https://ci.testling.com/Raynos/continuable-cache diff --git a/node_modules/continuable-cache/index.js b/node_modules/continuable-cache/index.js new file mode 100644 index 0000000..59802bb --- /dev/null +++ b/node_modules/continuable-cache/index.js @@ -0,0 +1,29 @@ +var Nil = {} + +module.exports = cache + +// cache := (Continuable<T>) => Continuable<T> +function cache(source) { + var _err = Nil + var _value = Nil + var _result = null + var listeners = null + + return function continuable(callback) { + if (_err !== Nil || _value !== Nil) { + callback(_err, _value) + } else if (listeners) { + listeners.push(callback) + } else { + listeners = [callback] + _result = source(function (err, value) { + _err = err + _value = value + + listeners.forEach(function (l) { l(err, value) }) + }) + } + + return _result + } +} diff --git a/node_modules/continuable-cache/package.json b/node_modules/continuable-cache/package.json new file mode 100644 index 0000000..5947aa6 --- /dev/null +++ b/node_modules/continuable-cache/package.json @@ -0,0 +1,50 @@ +{ + "name": "continuable-cache", + "version": "0.3.1", + "description": "Cache a continuable", + "keywords": [], + "author": "Raynos <raynos2@gmail.com>", + "repository": "git://github.com/Raynos/continuable-cache.git", + "main": "index", + "homepage": "https://github.com/Raynos/continuable-cache", + "contributors": [ + { + "name": "Raynos" + } + ], + "bugs": { + "url": "https://github.com/Raynos/continuable-cache/issues", + "email": "raynos2@gmail.com" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~0.2.2" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/Raynos/continuable-cache/raw/master/LICENSE" + } + ], + "scripts": { + "test": "node ./test/index.js", + "build-test": "browserify-server --bundle=test/index.js -o test/static/bundle.js --debug", + "tryme": "tryme ./examples --live", + "example": "browservefy ./examples/simple.js --browserify='browserify-server' --live --indexed=./examples -- --debug --bundle" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + } +} diff --git a/node_modules/continuable-cache/test/index.js b/node_modules/continuable-cache/test/index.js new file mode 100644 index 0000000..ba8cfc5 --- /dev/null +++ b/node_modules/continuable-cache/test/index.js @@ -0,0 +1,8 @@ +var test = require("tape") + +var cache = require("../index") + +test("continuable-cache is a function", function (assert) { + assert.equal(typeof cache, "function") + assert.end() +}) |