fix
This commit is contained in:
42
book/node_modules/continuable-cache/.jshintrc
generated
vendored
Normal file
42
book/node_modules/continuable-cache/.jshintrc
generated
vendored
Normal file
@@ -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
|
||||
}
|
||||
15
book/node_modules/continuable-cache/.npmignore
generated
vendored
Normal file
15
book/node_modules/continuable-cache/.npmignore
generated
vendored
Normal file
@@ -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
|
||||
14
book/node_modules/continuable-cache/.testem.json
generated
vendored
Normal file
14
book/node_modules/continuable-cache/.testem.json
generated
vendored
Normal file
@@ -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"]
|
||||
}
|
||||
6
book/node_modules/continuable-cache/.travis.yml
generated
vendored
Normal file
6
book/node_modules/continuable-cache/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- 0.9
|
||||
- 0.10
|
||||
script: node ./test/index.js
|
||||
19
book/node_modules/continuable-cache/LICENCE
generated
vendored
Normal file
19
book/node_modules/continuable-cache/LICENCE
generated
vendored
Normal file
@@ -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.
|
||||
48
book/node_modules/continuable-cache/README.md
generated
vendored
Normal file
48
book/node_modules/continuable-cache/README.md
generated
vendored
Normal file
@@ -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
|
||||
29
book/node_modules/continuable-cache/index.js
generated
vendored
Normal file
29
book/node_modules/continuable-cache/index.js
generated
vendored
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
50
book/node_modules/continuable-cache/package.json
generated
vendored
Normal file
50
book/node_modules/continuable-cache/package.json
generated
vendored
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
8
book/node_modules/continuable-cache/test/index.js
generated
vendored
Normal file
8
book/node_modules/continuable-cache/test/index.js
generated
vendored
Normal file
@@ -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()
|
||||
})
|
||||
Reference in New Issue
Block a user