Add csrf module

This commit is contained in:
Timothy Warren 2014-09-24 17:56:53 -04:00
parent 41a7f7e20d
commit 21e43fa553
492 changed files with 46264 additions and 18749 deletions

View File

@ -1,3 +1,9 @@
1.8.3 / 2014-09-19
==================
* deps: qs@2.2.4
- Fix issue with object keys starting with numbers truncated
1.8.2 / 2014-09-15 1.8.2 / 2014-09-15
================== ==================

92
node_modules/body-parser/README.md generated vendored
View File

@ -4,7 +4,7 @@
[![NPM Downloads][downloads-image]][downloads-url] [![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url] [![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url] [![Test Coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url] [![Gratipay][gratipay-image]][gratipay-url]
Node.js body parsing middleware. Node.js body parsing middleware.
@ -29,24 +29,7 @@ $ npm install body-parser
## API ## API
```js ```js
var express = require('express')
var bodyParser = require('body-parser') var bodyParser = require('body-parser')
var app = express()
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
// parse application/vnd.api+json as json
app.use(bodyParser.json({ type: 'application/vnd.api+json' }))
app.use(function (req, res, next) {
console.log(req.body) // populated!
next()
})
``` ```
### bodyParser.json(options) ### bodyParser.json(options)
@ -124,6 +107,75 @@ The `verify` argument, if supplied, is called as `verify(req, res, buf, encoding
A new `body` object containing the parsed data is populated on the `request` object after the middleware. A new `body` object containing the parsed data is populated on the `request` object after the middleware.
## Examples
### express/connect top-level generic
This example demonstrates adding a generic JSON and urlencoded parser as a top-level middleware, which will parse the bodies of all incoming requests. This is the simplest setup.
```js
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
app.use(function (req, res) {
res.setHeader('Content-Type', 'text/plain')
res.write('you posted:\n')
res.end(JSON.stringify(req.body, null, 2))
})
```
### express route-specific
This example demonstrates adding body parsers specifically to the routes that need them. In general, this is the most recommend way to use body-parser with express.
```js
var express = require('express')
var bodyParser = require('body-parser')
var app = express()
// create application/json parser
var jsonParser = bodyParser.json()
// create application/x-www-form-urlencoded parser
var urlencodedParser = bodyParser.urlencoded({ extended: false })
// POST /login gets urlencoded bodies
app.post('/login', urlencodedParser, function (req, res) {
if (!req.body) return res.sendStatus(400)
res.send('welcome, ' + res.body.username)
})
// POST /api/users gets JSON bodies
app.post('/api/users', jsonParser, function (req, res) {
if (!req.body) return res.sendStatus(400)
// create user in req.body
})
```
### change content-type for parsers
All the parsers accept a `type` option which allows you to change the `Content-Type` that the middleware will parse.
```js
// parse various different custom JSON types as JSON
app.use(bodyParser.json({ type: 'application/*+json' }))
// parse some custom thing into a Buffer
app.use(bodyParser.raw({ type: 'application/vnd.custom-type' }))
// parse an HTML body into a string
app.use(bodyParser.text({ type: 'text/html' }))
```
## License ## License
[MIT](LICENSE) [MIT](LICENSE)
@ -136,5 +188,5 @@ A new `body` object containing the parsed data is populated on the `request` obj
[coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master [coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master
[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg?style=flat [downloads-image]: https://img.shields.io/npm/dm/body-parser.svg?style=flat
[downloads-url]: https://npmjs.org/package/body-parser [downloads-url]: https://npmjs.org/package/body-parser
[gittip-image]: https://img.shields.io/gittip/dougwilson.svg?style=flat [gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg?style=flat
[gittip-url]: https://www.gittip.com/dougwilson/ [gratipay-url]: https://www.gratipay.com/dougwilson/

View File

@ -45,5 +45,6 @@
], ],
"directories": {}, "directories": {},
"_shasum": "3569ede8ba34315fab99c3e92cb04c7220de1fa8", "_shasum": "3569ede8ba34315fab99c3e92cb04c7220de1fa8",
"_resolved": "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz" "_resolved": "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -53,5 +53,6 @@
"tarball": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" "tarball": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" "_resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -59,5 +59,6 @@
"tarball": "http://registry.npmjs.org/ee-first/-/ee-first-1.0.5.tgz" "tarball": "http://registry.npmjs.org/ee-first/-/ee-first-1.0.5.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.0.5.tgz" "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.0.5.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -45,7 +45,7 @@
"homepage": "https://github.com/jshttp/on-finished", "homepage": "https://github.com/jshttp/on-finished",
"_id": "on-finished@2.1.0", "_id": "on-finished@2.1.0",
"_shasum": "0c539f09291e8ffadde0c8a25850fb2cedc7022d", "_shasum": "0c539f09291e8ffadde0c8a25850fb2cedc7022d",
"_from": "on-finished@~2.1.0", "_from": "on-finished@2.1.0",
"_npmVersion": "1.4.21", "_npmVersion": "1.4.21",
"_npmUser": { "_npmUser": {
"name": "dougwilson", "name": "dougwilson",
@ -66,5 +66,6 @@
"tarball": "http://registry.npmjs.org/on-finished/-/on-finished-2.1.0.tgz" "tarball": "http://registry.npmjs.org/on-finished/-/on-finished-2.1.0.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.1.0.tgz" "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.1.0.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -1,5 +1,5 @@
## [**2.2.3**](https://github.com/hapijs/qs/issues?milestone=12&state=open) ## [**2.2.3**](https://github.com/hapijs/qs/issues?milestone=12&state=closed)
- [**#37**](https://github.com/hapijs/qs/issues/37) parser discards first empty value in array - [**#37**](https://github.com/hapijs/qs/issues/37) parser discards first empty value in array
- [**#36**](https://github.com/hapijs/qs/issues/36) Update to lab 4.x - [**#36**](https://github.com/hapijs/qs/issues/36) Update to lab 4.x
@ -8,45 +8,22 @@
- [**#34**](https://github.com/hapijs/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty - [**#34**](https://github.com/hapijs/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty
- [**#24**](https://github.com/hapijs/qs/issues/24) Changelog? Semver? - [**#24**](https://github.com/hapijs/qs/issues/24) Changelog? Semver?
---
## [**2.2.2**](https://github.com/hapijs/qs/issues?milestone=11&state=closed)
- [**#33**](https://github.com/hapijs/qs/issues/33) Error when plain object in a value
- [**#34**](https://github.com/hapijs/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty
- [**#24**](https://github.com/hapijs/qs/issues/24) Changelog? Semver?
---
## [**2.2.2**](https://github.com/hapijs/qs/issues?milestone=11&state=open)
- [**#34**](https://github.com/hapijs/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty
- [**#24**](https://github.com/hapijs/qs/issues/24) Changelog? Semver?
---
# 2014-08-28
95 commits against 24 issues, over a month [`32edf33`](https://github.com/hapijs/qs/commit/32edf33)⎆[`b1e7b53`](https://github.com/hapijs/qs/commit/b1e7b53)
## [**2.2.1**](https://github.com/hapijs/qs/issues?milestone=10&state=closed) ## [**2.2.1**](https://github.com/hapijs/qs/issues?milestone=10&state=closed)
- [**#32**](https://github.com/hapijs/qs/issues/32) account for circular references properly, closes #31 - [**#32**](https://github.com/hapijs/qs/issues/32) account for circular references properly, closes #31
- [**#31**](https://github.com/hapijs/qs/issues/31) qs.parse stackoverflow on circular objects - [**#31**](https://github.com/hapijs/qs/issues/31) qs.parse stackoverflow on circular objects
## [**2.2.0**](https://github.com/hapijs/qs/issues?milestone=9&state=closed) ## [**2.2.0**](https://github.com/hapijs/qs/issues?milestone=9&state=closed)
- [**#26**](https://github.com/hapijs/qs/issues/26) Don't use Buffer global if it's not present
- [**#30**](https://github.com/hapijs/qs/issues/30) Bug when merging non-object values into arrays - [**#30**](https://github.com/hapijs/qs/issues/30) Bug when merging non-object values into arrays
- [**#29**](https://github.com/hapijs/qs/issues/29) Don't call Utils.clone at the top of Utils.merge - [**#29**](https://github.com/hapijs/qs/issues/29) Don't call Utils.clone at the top of Utils.merge
- [**#26**](https://github.com/hapijs/qs/issues/26) Don't use Buffer global if it's not present
- [**#23**](https://github.com/hapijs/qs/issues/23) Ability to not limit parameters? - [**#23**](https://github.com/hapijs/qs/issues/23) Ability to not limit parameters?
## [**2.1.0**](https://github.com/hapijs/qs/issues?milestone=8&state=closed) ## [**2.1.0**](https://github.com/hapijs/qs/issues?milestone=8&state=closed)
- [**#22**](https://github.com/hapijs/qs/issues/22) Enable using a RegExp as delimiter - [**#22**](https://github.com/hapijs/qs/issues/22) Enable using a RegExp as delimiter
## [**2.0.0**](https://github.com/hapijs/qs/issues?milestone=7&state=closed) ## [**2.0.0**](https://github.com/hapijs/qs/issues?milestone=7&state=closed)
- [**#20**](https://github.com/hapijs/qs/issues/20) Configurable parametersLimit
- [**#18**](https://github.com/hapijs/qs/issues/18) Why is there arrayLimit? - [**#18**](https://github.com/hapijs/qs/issues/18) Why is there arrayLimit?
- [**#20**](https://github.com/hapijs/qs/issues/20) Configurable parametersLimit
- [**#21**](https://github.com/hapijs/qs/issues/21) make all limits optional, for #18, for #20 - [**#21**](https://github.com/hapijs/qs/issues/21) make all limits optional, for #18, for #20
## [**1.2.2**](https://github.com/hapijs/qs/issues?milestone=6&state=closed) ## [**1.2.2**](https://github.com/hapijs/qs/issues?milestone=6&state=closed)
@ -68,11 +45,3 @@
## [**1.0.2**](https://github.com/hapijs/qs/issues?milestone=2&state=closed) ## [**1.0.2**](https://github.com/hapijs/qs/issues?milestone=2&state=closed)
- [**#5**](https://github.com/hapijs/qs/issues/5) array holes incorrectly copied into object on large index - [**#5**](https://github.com/hapijs/qs/issues/5) array holes incorrectly copied into object on large index
## Issues
- [**#25**](https://github.com/hapijs/qs/issues/25) Remove references to Buffer
- [**#11**](https://github.com/hapijs/qs/issues/11) Flattened keys in array does not parse correctly
- [**#8**](https://github.com/hapijs/qs/issues/8) Square brackets should be URI encoded
- [**#3**](https://github.com/hapijs/qs/issues/3) Update README.md
- [**#2**](https://github.com/hapijs/qs/issues/2) Add travis and rework package

View File

@ -58,8 +58,10 @@ internals.parseObject = function (chain, val, options) {
else { else {
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
var index = parseInt(cleanRoot, 10); var index = parseInt(cleanRoot, 10);
var indexString = '' + index;
if (!isNaN(index) && if (!isNaN(index) &&
root !== cleanRoot && root !== cleanRoot &&
indexString === cleanRoot &&
index <= options.arrayLimit) { index <= options.arrayLimit) {
obj = []; obj = [];

View File

@ -1,6 +1,6 @@
{ {
"name": "qs", "name": "qs",
"version": "2.2.3", "version": "2.2.4",
"description": "A querystring parser that supports nesting and arrays, with a depth limit", "description": "A querystring parser that supports nesting and arrays, with a depth limit",
"homepage": "https://github.com/hapijs/qs", "homepage": "https://github.com/hapijs/qs",
"main": "index.js", "main": "index.js",
@ -29,13 +29,13 @@
"url": "http://github.com/hapijs/qs/raw/master/LICENSE" "url": "http://github.com/hapijs/qs/raw/master/LICENSE"
} }
], ],
"gitHead": "904528124a6eb879ebc5197376e9613069414f67", "gitHead": "9775242fa57cbfa4db62e4b0aa4f82b23e2ce6af",
"bugs": { "bugs": {
"url": "https://github.com/hapijs/qs/issues" "url": "https://github.com/hapijs/qs/issues"
}, },
"_id": "qs@2.2.3", "_id": "qs@2.2.4",
"_shasum": "6139c1f47960eff5655e56aab0ef9f6dd16d4eeb", "_shasum": "2e9fbcd34b540e3421c924ecd01e90aa975319c8",
"_from": "qs@2.2.3", "_from": "qs@2.2.4",
"_npmVersion": "1.4.23", "_npmVersion": "1.4.23",
"_npmUser": { "_npmUser": {
"name": "nlf", "name": "nlf",
@ -52,9 +52,9 @@
} }
], ],
"dist": { "dist": {
"shasum": "6139c1f47960eff5655e56aab0ef9f6dd16d4eeb", "shasum": "2e9fbcd34b540e3421c924ecd01e90aa975319c8",
"tarball": "http://registry.npmjs.org/qs/-/qs-2.2.3.tgz" "tarball": "http://registry.npmjs.org/qs/-/qs-2.2.4.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/qs/-/qs-2.2.3.tgz" "_resolved": "https://registry.npmjs.org/qs/-/qs-2.2.4.tgz"
} }

View File

@ -104,6 +104,12 @@ describe('#parse', function () {
done(); done();
}); });
it('supports keys that begin with a number', function (done) {
expect(Qs.parse('a[12b]=c')).to.deep.equal({ a: { '12b': 'c' } });
done();
});
it('supports encoded = signs', function (done) { it('supports encoded = signs', function (done) {
expect(Qs.parse('he%3Dllo=th%3Dere')).to.deep.equal({ 'he=llo': 'th=ere' }); expect(Qs.parse('he%3Dllo=th%3Dere')).to.deep.equal({ 'he=llo': 'th=ere' });

View File

@ -67,5 +67,6 @@
], ],
"directories": {}, "directories": {},
"_shasum": "978230a156a5548f42eef14de22d0f4f610083d1", "_shasum": "978230a156a5548f42eef14de22d0f4f610083d1",
"_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.3.0.tgz" "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.3.0.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "body-parser", "name": "body-parser",
"description": "Node.js body parsing middleware", "description": "Node.js body parsing middleware",
"version": "1.8.2", "version": "1.8.3",
"contributors": [ "contributors": [
{ {
"name": "Douglas Christopher Wilson", "name": "Douglas Christopher Wilson",
@ -24,7 +24,7 @@
"iconv-lite": "0.4.4", "iconv-lite": "0.4.4",
"media-typer": "0.3.0", "media-typer": "0.3.0",
"on-finished": "2.1.0", "on-finished": "2.1.0",
"qs": "2.2.3", "qs": "2.2.4",
"raw-body": "1.3.0", "raw-body": "1.3.0",
"type-is": "~1.5.1" "type-is": "~1.5.1"
}, },
@ -48,14 +48,14 @@
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/" "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/"
}, },
"gitHead": "caf6e06cf7b4e3d31717e75e31dc2efc873a1047", "gitHead": "b4131a69a898ec4238679bc8bad7aa5359a7ecc7",
"bugs": { "bugs": {
"url": "https://github.com/expressjs/body-parser/issues" "url": "https://github.com/expressjs/body-parser/issues"
}, },
"homepage": "https://github.com/expressjs/body-parser", "homepage": "https://github.com/expressjs/body-parser",
"_id": "body-parser@1.8.2", "_id": "body-parser@1.8.3",
"_shasum": "cb55519e748f2ac89bd3c8e34cb759d391c4d67d", "_shasum": "922b82e6448d654f2f5197574ceacefc04a6a8af",
"_from": "body-parser@1.8.2", "_from": "body-parser@1.8.3",
"_npmVersion": "1.4.21", "_npmVersion": "1.4.21",
"_npmUser": { "_npmUser": {
"name": "dougwilson", "name": "dougwilson",
@ -88,9 +88,9 @@
} }
], ],
"dist": { "dist": {
"shasum": "cb55519e748f2ac89bd3c8e34cb759d391c4d67d", "shasum": "922b82e6448d654f2f5197574ceacefc04a6a8af",
"tarball": "http://registry.npmjs.org/body-parser/-/body-parser-1.8.2.tgz" "tarball": "http://registry.npmjs.org/body-parser/-/body-parser-1.8.3.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.8.2.tgz" "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.8.3.tgz"
} }

50
node_modules/csurf/HISTORY.md generated vendored Normal file
View File

@ -0,0 +1,50 @@
1.6.1 / 2014-09-05
==================
* bump cookie-signature
1.6.0 / 2014-09-03
==================
* set `code` property on CSRF token errors
1.5.0 / 2014-08-24
==================
* add `ignoreMethods` option
1.4.1 / 2014-08-22
==================
* csrf-tokens -> csrf
1.4.0 / 2014-07-30
==================
* Support changing `req.session` after `csurf` middleware
- Calling `res.csrfToken()` after `req.session.destroy()` will now work
1.3.0 / 2014-07-03
==================
* add support for environments without `res.cookie` (connect@3)
1.2.2 / 2014-06-18
==================
* bump csrf-tokens
1.2.1 / 2014-06-09
==================
* refactor to use csrf-tokens
1.2.0 / 2014-05-13
==================
* add support for double-submit cookie
1.1.0 / 2014-04-06
==================
* add constant-time string compare

View File

@ -1,23 +1,22 @@
The MIT Expat Licence. (The MIT License)
Copyright (c) 2012 Michael Mclaughlin Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including 'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to permit persons to whom the Software is furnished to do so, subject to
the following conditions: the following conditions:
The above copyright notice and this permission notice shall be The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software. included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

78
node_modules/csurf/README.md generated vendored Normal file
View File

@ -0,0 +1,78 @@
# csurf
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
Node.js [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection middleware.
Requires either a session middleware or [cookie-parser](https://github.com/expressjs/cookie-parser) to be initialized first.
- [session](https://github.com/expressjs/session)
- [cookie-session](https://github.com/expressjs/cookie-session)
### Install
```sh
$ npm install csurf
```
## API
```js
var csrf = require('csurf')
```
### csrf(options)
This middleware adds a `req.csrfToken()` function to make a token which should be added to requests which mutate state, within a hidden form field, query-string etc. This token is validated against the visitor's session or csrf cookie.
#### Options
- `value` a function accepting the request, returning the token.
- The default function checks four possible token locations:
- `_csrf` parameter in `req.body` generated by the `body-parser` middleware.
- `_csrf` parameter in `req.query` generated by `query()`.
- `x-csrf-token` and `x-xsrf-token` header fields.
- `cookie` set to a truthy value to enable cookie-based instead of session-based csrf secret storage.
- If `cookie` is an object, these options can be configured, otherwise defaults are used:
- `key` the name of the cookie to use (defaults to `_csrf`) to store the csrf secret
- any other [res.cookie](http://expressjs.com/4x/api.html#res.cookie) options can be set
- `ignoreMethods` An array of the methods CSRF token checking will disabled.
(default: `['GET', 'HEAD', 'OPTIONS']`)
### req.csrfToken()
Lazy-loads the token associated with the request.
## Example
```js
var express = require('express')
var csrf = require('csurf')
var app = express()
app.use(csrf())
// error handler
app.use(function (err, req, res, next) {
if (err.code !== 'EBADCSRFTOKEN') return next(err)
// handle CSRF token errors here
res.status(403)
res.send('session has expired or form tampered with')
})
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/csurf.svg?style=flat
[npm-url]: https://npmjs.org/package/csurf
[travis-image]: https://img.shields.io/travis/expressjs/csurf.svg?style=flat
[travis-url]: https://travis-ci.org/expressjs/csurf
[coveralls-image]: https://img.shields.io/coveralls/expressjs/csurf.svg?style=flat
[coveralls-url]: https://coveralls.io/r/expressjs/csurf?branch=master
[downloads-image]: https://img.shields.io/npm/dm/csurf.svg?style=flat
[downloads-url]: https://npmjs.org/package/csurf

238
node_modules/csurf/index.js generated vendored Normal file
View File

@ -0,0 +1,238 @@
/*!
* csurf
* Copyright(c) 2011 Sencha Inc.
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014 Douglas Christopher Wilson
* MIT Licensed
*/
/**
* Module dependencies.
*/
var Cookie = require('cookie');
var csrfTokens = require('csrf');
var sign = require('cookie-signature').sign;
/**
* CSRF protection middleware.
*
* This middleware adds a `req.csrfToken()` function to make a token
* which should be added to requests which mutate
* state, within a hidden form field, query-string etc. This
* token is validated against the visitor's session.
*
* @param {Object} options
* @return {Function} middleware
* @api public
*/
module.exports = function csurf(options) {
options = options || {};
// get value getter
var value = options.value || defaultValue
// token repo
var tokens = csrfTokens(options);
// default cookie key
if (options.cookie && !options.cookie.key) {
options.cookie.key = '_csrf'
}
// ignored methods
var ignoreMethods = options.ignoreMethods === undefined
? ['GET', 'HEAD', 'OPTIONS']
: options.ignoreMethods
if (!Array.isArray(ignoreMethods)) {
throw new TypeError('option ignoreMethods must be an array')
}
// generate lookup
var ignoreMethod = getIgnoredMethods(ignoreMethods)
return function csrf(req, res, next) {
var secret = getsecret(req, options.cookie)
var token
// lazy-load token getter
req.csrfToken = function csrfToken() {
var sec = !options.cookie
? getsecret(req, options.cookie)
: secret
// use cached token if secret has not changed
if (token && sec === secret) {
return token
}
// generate & set new secret
if (sec === undefined) {
sec = tokens.secretSync()
setsecret(req, res, sec, options.cookie)
}
// update changed secret
secret = sec
// create new token
token = tokens.create(secret)
return token
}
// generate & set secret
if (!secret) {
secret = tokens.secretSync()
setsecret(req, res, secret, options.cookie)
}
// verify the incoming token
if (!ignoreMethod[req.method]) {
verifytoken(req, tokens, secret, value(req))
}
next()
}
};
/**
* Default value function, checking the `req.body`
* and `req.query` for the CSRF token.
*
* @param {IncomingMessage} req
* @return {String}
* @api private
*/
function defaultValue(req) {
return (req.body && req.body._csrf)
|| (req.query && req.query._csrf)
|| (req.headers['x-csrf-token'])
|| (req.headers['x-xsrf-token']);
}
/**
* Get a lookup of ignored methods.
*
* @param {array} methods
* @returns {object}
* @api private
*/
function getIgnoredMethods(methods) {
var obj = Object.create(null)
for (var i = 0; i < methods.length; i++) {
var method = methods[i].toUpperCase()
obj[method] = true
}
return obj
}
/**
* Get the token secret from the request.
*
* @param {IncomingMessage} req
* @param {Object} [cookie]
* @api private
*/
function getsecret(req, cookie) {
var secret
if (cookie) {
// get secret from cookie
var bag = cookie.signed
? 'signedCookies'
: 'cookies'
secret = req[bag][cookie.key]
} else if (req.session) {
// get secret from session
secret = req.session.csrfSecret
} else {
throw new Error('misconfigured csrf')
}
return secret
}
/**
* Set a cookie on the HTTP response.
*
* @param {OutgoingMessage} res
* @param {string} name
* @param {string} val
* @param {Object} [options]
* @api private
*/
function setcookie(res, name, val, options) {
var data = Cookie.serialize(name, val, options);
var prev = res.getHeader('set-cookie') || [];
var header = Array.isArray(prev) ? prev.concat(data)
: Array.isArray(data) ? [prev].concat(data)
: [prev, data];
res.setHeader('set-cookie', header);
}
/**
* Set the token secret on the request.
*
* @param {IncomingMessage} req
* @param {OutgoingMessage} res
* @param {string} val
* @param {Object} [cookie]
* @api private
*/
function setsecret(req, res, val, cookie) {
if (cookie) {
// set secret on cookie
if (cookie.signed) {
var secret = req.secret
if (!secret) {
throw new Error('cookieParser("secret") required for signed cookies')
}
val = 's:' + sign(val, secret)
}
setcookie(res, cookie.key, val, cookie);
} else if (req.session) {
// set secret on session
req.session.csrfSecret = val
} else {
/* istanbul ignore next: should never actually run */
throw new Error('misconfigured csrf')
}
}
/**
* Verify the token.
*
* @param {IncomingMessage} req
* @param {Object} tokens
* @param {string} secret
* @param {string} val
* @api private
*/
function verifytoken(req, tokens, secret, val) {
// valid token
if (tokens.verify(secret, val)) {
return
}
var err = new Error('invalid csrf token')
err.status = 403
err.code = 'EBADCSRFTOKEN'
throw err
}

View File

@ -1,6 +1,4 @@
support support
test test
examples examples
example
*.sock *.sock
dist

View File

@ -0,0 +1,27 @@
1.0.4 / 2014-06-25
==================
* corrected avoidance of timing attacks (thanks @tenbits!)
1.0.3 / 2014-01-28
==================
* [incorrect] fix for timing attacks
1.0.2 / 2014-01-28
==================
* fix missing repository warning
* fix typo in test
1.0.1 / 2013-04-15
==================
* Revert "Changed underlying HMAC algo. to sha512."
* Revert "Fix for timing attacks on MAC verification."
0.0.1 / 2010-01-03
==================
* Initial release

View File

@ -0,0 +1,7 @@
test:
@./node_modules/.bin/mocha \
--require should \
--reporter spec
.PHONY: test

View File

@ -0,0 +1,42 @@
# cookie-signature
Sign and unsign cookies.
## Example
```js
var cookie = require('cookie-signature');
var val = cookie.sign('hello', 'tobiiscool');
val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');
var val = cookie.sign('hello', 'tobiiscool');
cookie.unsign(val, 'tobiiscool').should.equal('hello');
cookie.unsign(val, 'luna').should.be.false;
```
## License
(The MIT License)
Copyright (c) 2012 LearnBoost &lt;tj@learnboost.com&gt;
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.

View File

@ -0,0 +1,51 @@
/**
* Module dependencies.
*/
var crypto = require('crypto');
/**
* Sign the given `val` with `secret`.
*
* @param {String} val
* @param {String} secret
* @return {String}
* @api private
*/
exports.sign = function(val, secret){
if ('string' != typeof val) throw new TypeError('cookie required');
if ('string' != typeof secret) throw new TypeError('secret required');
return val + '.' + crypto
.createHmac('sha256', secret)
.update(val)
.digest('base64')
.replace(/\=+$/, '');
};
/**
* Unsign and decode the given `val` with `secret`,
* returning `false` if the signature is invalid.
*
* @param {String} val
* @param {String} secret
* @return {String|Boolean}
* @api private
*/
exports.unsign = function(val, secret){
if ('string' != typeof val) throw new TypeError('cookie required');
if ('string' != typeof secret) throw new TypeError('secret required');
var str = val.slice(0, val.lastIndexOf('.'))
, mac = exports.sign(str, secret);
return sha1(mac) == sha1(val) ? str : false;
};
/**
* Private
*/
function sha1(str){
return crypto.createHash('sha1').update(str).digest('hex');
}

View File

@ -0,0 +1,56 @@
{
"name": "cookie-signature",
"version": "1.0.5",
"description": "Sign and unsign cookies",
"keywords": [
"cookie",
"sign",
"unsign"
],
"author": {
"name": "TJ Holowaychuk",
"email": "tj@learnboost.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/visionmedia/node-cookie-signature.git"
},
"dependencies": {},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"main": "index",
"gitHead": "73ed69b511b3ef47555d71b4ed1deea9e5ed6e1f",
"bugs": {
"url": "https://github.com/visionmedia/node-cookie-signature/issues"
},
"homepage": "https://github.com/visionmedia/node-cookie-signature",
"_id": "cookie-signature@1.0.5",
"scripts": {},
"_shasum": "a122e3f1503eca0f5355795b0711bb2368d450f9",
"_from": "cookie-signature@1.0.5",
"_npmVersion": "1.4.20",
"_npmUser": {
"name": "natevw",
"email": "natevw@yahoo.com"
},
"maintainers": [
{
"name": "tjholowaychuk",
"email": "tj@vision-media.ca"
},
{
"name": "natevw",
"email": "natevw@yahoo.com"
}
],
"dist": {
"shasum": "a122e3f1503eca0f5355795b0711bb2368d450f9",
"tarball": "http://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.5.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.5.tgz",
"readme": "ERROR: No README data found!"
}

2
node_modules/csurf/node_modules/cookie/.npmignore generated vendored Normal file
View File

@ -0,0 +1,2 @@
test
.travis.yml

9
node_modules/csurf/node_modules/cookie/LICENSE generated vendored Normal file
View File

@ -0,0 +1,9 @@
// MIT License
Copyright (C) Roman Shtylman <shtylman@gmail.com>
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.

44
node_modules/csurf/node_modules/cookie/README.md generated vendored Normal file
View File

@ -0,0 +1,44 @@
# cookie [![Build Status](https://secure.travis-ci.org/defunctzombie/node-cookie.png?branch=master)](http://travis-ci.org/defunctzombie/node-cookie) #
cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.
See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.
## how?
```
npm install cookie
```
```javascript
var cookie = require('cookie');
var hdr = cookie.serialize('foo', 'bar');
// hdr = 'foo=bar';
var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');
// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };
```
## more
The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.
### path
> cookie path
### expires
> absolute expiration date for the cookie (Date object)
### maxAge
> relative max age of the cookie from when the client receives it (seconds)
### domain
> domain for the cookie
### secure
> true or false
### httpOnly
> true or false

75
node_modules/csurf/node_modules/cookie/index.js generated vendored Normal file
View File

@ -0,0 +1,75 @@
/// Serialize the a name value pair into a cookie string suitable for
/// http headers. An optional options object specified cookie parameters
///
/// serialize('foo', 'bar', { httpOnly: true })
/// => "foo=bar; httpOnly"
///
/// @param {String} name
/// @param {String} val
/// @param {Object} options
/// @return {String}
var serialize = function(name, val, opt){
opt = opt || {};
var enc = opt.encode || encode;
var pairs = [name + '=' + enc(val)];
if (null != opt.maxAge) {
var maxAge = opt.maxAge - 0;
if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
pairs.push('Max-Age=' + maxAge);
}
if (opt.domain) pairs.push('Domain=' + opt.domain);
if (opt.path) pairs.push('Path=' + opt.path);
if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString());
if (opt.httpOnly) pairs.push('HttpOnly');
if (opt.secure) pairs.push('Secure');
return pairs.join('; ');
};
/// Parse the given cookie header string into an object
/// The object has the various cookies as keys(names) => values
/// @param {String} str
/// @return {Object}
var parse = function(str, opt) {
opt = opt || {};
var obj = {}
var pairs = str.split(/; */);
var dec = opt.decode || decode;
pairs.forEach(function(pair) {
var eq_idx = pair.indexOf('=')
// skip things that don't look like key=value
if (eq_idx < 0) {
return;
}
var key = pair.substr(0, eq_idx).trim()
var val = pair.substr(++eq_idx, pair.length).trim();
// quoted values
if ('"' == val[0]) {
val = val.slice(1, -1);
}
// only assign once
if (undefined == obj[key]) {
try {
obj[key] = dec(val);
} catch (e) {
obj[key] = val;
}
}
});
return obj;
};
var encode = encodeURIComponent;
var decode = decodeURIComponent;
module.exports.serialize = serialize;
module.exports.parse = parse;

54
node_modules/csurf/node_modules/cookie/package.json generated vendored Normal file
View File

@ -0,0 +1,54 @@
{
"author": {
"name": "Roman Shtylman",
"email": "shtylman@gmail.com"
},
"name": "cookie",
"description": "cookie parsing and serialization",
"version": "0.1.2",
"repository": {
"type": "git",
"url": "git://github.com/shtylman/node-cookie.git"
},
"keywords": [
"cookie",
"cookies"
],
"main": "index.js",
"scripts": {
"test": "mocha"
},
"dependencies": {},
"devDependencies": {
"mocha": "1.x.x"
},
"optionalDependencies": {},
"engines": {
"node": "*"
},
"bugs": {
"url": "https://github.com/shtylman/node-cookie/issues"
},
"homepage": "https://github.com/shtylman/node-cookie",
"_id": "cookie@0.1.2",
"dist": {
"shasum": "72fec3d24e48a3432073d90c12642005061004b1",
"tarball": "http://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz"
},
"_from": "cookie@0.1.2",
"_npmVersion": "1.4.6",
"_npmUser": {
"name": "shtylman",
"email": "shtylman@gmail.com"
},
"maintainers": [
{
"name": "shtylman",
"email": "shtylman@gmail.com"
}
],
"directories": {},
"_shasum": "72fec3d24e48a3432073d90c12642005061004b1",
"_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz",
"readme": "ERROR: No README data found!"
}

81
node_modules/csurf/node_modules/csrf/README.md generated vendored Normal file
View File

@ -0,0 +1,81 @@
# CSRF
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
Logic behind CSRF token creation and verification.
Read [Understanding-CSRF](http://www.jongleberry.com/understanding-csrf.html) for more information on CSRF.
Use this module to create custom CSRF middleware and what not.
### Install
```bash
$ npm install csrf-tokens
```
## API
```js
var tokens = require('csrf-tokens')(options)
var secret = tokens.secretSync()
var token = tokens.create(secret)
var valid = tokens.verify(secret, token)
```
### Options
- `secretLength: 24` - the byte length of the secret key
- `saltLength: 8` - the string length of the salt
- `tokensize: (secret, salt) => token` - a custom token creation function
#### tokens.secret([cb])
Asynchronously create a new `secret` of length `secretLength`.
If `cb` is not defined, a promise is returned.
You don't have to use this.
```js
tokens.secret().then(function (secret) {
})
tokens.secret(function (err, secret) {
})
```
#### var secret = tokens.secretSync()
Synchronous version of `tokens.secret()`
#### var token = tokens.token(secret)
Create a CSRF token based on a `secret`.
This is the token you pass to clients.
#### var valid = tokens.verify(secret, token)
Check whether a CSRF token is valid based on a `secret`.
If it's not valid, you should probably throw a `403` error.
## [License (MIT)](LICENSE)
[npm-image]: https://img.shields.io/npm/v/csrf.svg?style=flat-square
[npm-url]: https://npmjs.org/package/csrf
[github-tag]: http://img.shields.io/github/tag/pillarjs/csrf.svg?style=flat-square
[github-url]: https://github.com/pillarjs/csrf/tags
[travis-image]: https://img.shields.io/travis/pillarjs/csrf.svg?style=flat-square
[travis-url]: https://travis-ci.org/pillarjs/csrf
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/csrf.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/pillarjs/csrf?branch=master
[david-image]: http://img.shields.io/david/pillarjs/csrf.svg?style=flat-square
[david-url]: https://david-dm.org/pillarjs/csrf
[license-image]: http://img.shields.io/npm/l/csrf.svg?style=flat-square
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/csrf.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/csrf

59
node_modules/csurf/node_modules/csrf/index.js generated vendored Normal file
View File

@ -0,0 +1,59 @@
var rndm = require('rndm')
var scmp = require('scmp')
var uid = require('uid-safe')
var crypto = require('crypto')
var escape = require('base64-url').escape
module.exports = csrfTokens
function csrfTokens(options) {
options = options || {}
// adjustable lengths
var secretLength = options.secretLength || 18 // the longer the better
var saltLength = options.saltLength || 8 // doesn't need to be long
// convert a secret + a salt to a token
// this does NOT have to be cryptographically secure, so we don't use HMAC,
// and we use sha1 because sha256 is unnecessarily long for cookies and stuff
var tokenize = options.tokenize || csrfTokens.tokenize
return {
// create a secret key
// this __should__ be cryptographically secure,
// but generally client's can't/shouldn't-be-able-to access this so it really doesn't matter.
secret: function secret(cb) {
return uid(secretLength, cb)
},
// a sync version of secret()
secretSync: function secretSync() {
return uid.sync(secretLength)
},
// create a csrf token
create: function create(secret) {
return tokenize(secret, rndm(saltLength))
},
// verify whether a token is valid
verify: function verify(secret, token) {
if (!secret || typeof secret !== 'string') return false
if (!token || typeof token !== 'string') return false
var expected = tokenize(secret, token.split('-')[0])
if (!expected) return false
return scmp(token, expected)
},
}
}
csrfTokens.tokenize = function tokenize(secret, salt) {
var hash = escape(crypto
.createHash('sha1')
.update(salt)
.update('-')
.update(secret)
.digest('base64'))
return salt + '-' + hash
}

View File

@ -0,0 +1,12 @@
.*.swp
._*
.DS_Store
.git
.hg
.lock-wscript
.svn
.wafpickle-*
CVS
npm-debug.log
*.sublime-project
*.sublime-workspace

View File

@ -0,0 +1,12 @@
language: node_js
node_js:
- "0.11"
- "0.10"
- "0.8"
branches:
only:
- master
notifications:
email:
- joaquim.serafim@gmail.com
script: npm test

View File

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Joaquim José F. Serafim
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -0,0 +1,27 @@
# base64-url
Base64 encode, decode, escape and unescape for URL applications.
<a href="https://nodei.co/npm/base64-url/"><img src="https://nodei.co/npm/base64-url.png?downloads=true"></a>
[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url)
**V1**
####API
> base64url.encode('Node.js is awesome.');
Tm9kZS5qcyBpcyBhd2Vzb21lLg
> base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg');
Node.js is awesome.
> base64url.escape(This+is/goingto+escape==);
This-is_goingto-escape
> base64url.unescape('This-is_goingto-escape');
This+is/goingto+escape==

View File

@ -0,0 +1,17 @@
var base64url = exports;
base64url.unescape = function unescape (str) {
return (str + Array(5 - str.length % 4).join('=')).replace(/\-/g,'+').replace(/_/g, '/');
};
base64url.escape = function escape (str) {
return str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
};
base64url.encode = function encode (str) {
return this.escape(new Buffer(str).toString('base64'));
};
base64url.decode = function decode (str) {
return new Buffer(this.unescape(str), 'base64').toString();
};

View File

@ -0,0 +1,51 @@
{
"name": "base64-url",
"version": "1.0.0",
"description": "Base64 encode, decode, escape and unescape for URL applications",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "node test"
},
"repository": {
"type": "git",
"url": "git://github.com/joaquimserafim/base64-url.git"
},
"keywords": [
"base64",
"base64url"
],
"author": {
"name": "@joaquimserafim"
},
"license": "ISC",
"bugs": {
"url": "https://github.com/joaquimserafim/base64-url/issues"
},
"homepage": "https://github.com/joaquimserafim/base64-url",
"devDependencies": {
"tape": "^2.12.3"
},
"_id": "base64-url@1.0.0",
"_shasum": "ab694376f2801af6c9260899ffef02f86b40ee2c",
"_from": "base64-url@1.0.0",
"_npmVersion": "1.4.9",
"_npmUser": {
"name": "quim",
"email": "joaquim.serafim@gmail.com"
},
"maintainers": [
{
"name": "quim",
"email": "joaquim.serafim@gmail.com"
}
],
"dist": {
"shasum": "ab694376f2801af6c9260899ffef02f86b40ee2c",
"tarball": "http://registry.npmjs.org/base64-url/-/base64-url-1.0.0.tgz"
},
"_resolved": "https://registry.npmjs.org/base64-url/-/base64-url-1.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@ -0,0 +1,24 @@
var test = require('tape');
var base64url = require('../');
test('base64url', function (t) {
t.plan(4);
var text = 'Node.js is awesome.';
var encode = base64url.encode(text);
t.ok(encode, 'encode: ' + encode);
var decode = base64url.decode(encode);
t.deepEqual(decode, text, 'decode: ' + decode);
var text_escape = 'This+is/goingto+escape==';
console.log(text_escape);
var escape = base64url.escape(text_escape);
t.equal(escape.match(/\+|\//g), null, 'escape (omit + and /): ' + escape);
var unescape = base64url.unescape(escape);
t.equal(unescape.match(/\-|_/g), null, 'unescape (back to first form): ' + unescape);
});

View File

@ -0,0 +1,2 @@
.DS_Store*
node_modules

View File

@ -1,9 +1,13 @@
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to of this software and associated documentation files (the "Software"), to deal
deal in the Software without restriction, including without limitation the in the Software without restriction, including without limitation the rights
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
sell copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
@ -13,6 +17,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
IN THE SOFTWARE. THE SOFTWARE.

View File

@ -0,0 +1,15 @@
# RNDM
Random string generator.
Basically `Math.random().toString(36).slice(2)`,
but with both upper and lower case letters and arbitrary lengths.
Useful for creating fast, not cryptographically secure salts.
## API
```js
import rndm from 'rndm@1'
var salt = rndm(16)
```

View File

@ -0,0 +1,10 @@
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
var length = chars.length
module.exports = function rndm(len) {
var salt = ''
for (var i = 0; i < len; i++)
salt += chars[Math.floor(length * Math.random())]
return salt
}

View File

@ -0,0 +1,39 @@
{
"name": "rndm",
"description": "random string generator",
"version": "1.0.0",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/jonathanong/rndm"
},
"bugs": {
"url": "https://github.com/jonathanong/rndm/issues"
},
"homepage": "https://github.com/jonathanong/rndm",
"_id": "rndm@1.0.0",
"_shasum": "dcb6eb485b9b416d15e097f39c31458e4cfda2da",
"_from": "rndm@~1.0.0",
"_npmVersion": "1.4.9",
"_npmUser": {
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
"maintainers": [
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
}
],
"dist": {
"shasum": "dcb6eb485b9b416d15e097f39c31458e4cfda2da",
"tarball": "http://registry.npmjs.org/rndm/-/rndm-1.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/rndm/-/rndm-1.0.0.tgz"
}

View File

@ -0,0 +1,3 @@
node_modules/
.project

View File

@ -1,6 +1,5 @@
language: node_js language: node_js
node_js: node_js:
- "0.11" - "0.6"
- "0.10" - "0.8"
- "0.8" - "0.10"
- "0.6"

View File

@ -0,0 +1,31 @@
# scmp
[![Build Status](https://travis-ci.org/freewil/scmp.png)](https://travis-ci.org/freewil/scmp)
Safe, constant-time comparison of strings.
## Install
```
npm install scmp
```
## Why?
To minimize vulnerability against [timing attacks](http://codahale.com/a-lesson-in-timing-attacks/).
## Examples
```js
var scmp = require('scmp');
var hash = 'e727d1464ae12436e899a726da5b2f11d8381b26';
var givenHash = 'e727e1b80e448a213b392049888111e1779a52db';
if (scmp(hash, givenHash)) {
console.log('good hash');
} else {
console.log('bad hash');
}
```

View File

@ -0,0 +1,15 @@
var scmp = require('../');
suite('scmp', function() {
var HASH1 = 'e727d1464ae12436e899a726da5b2f11d8381b26';
var HASH2 = 'f727d1464ae12436e899a726da5b2f11d8381b26';
bench('short-circuit compares', function() {
HASH1 === HASH2;
});
bench('scmp compares', function() {
scmp(HASH1, HASH2);
});
});

View File

@ -0,0 +1,20 @@
/**
* Does a constant-time string comparison by not short-circuiting
* on first sign of non-equivalency.
*
* @param {String} a The first string to be compared against the second
* @param {String} b The second string to be compared against the first
* @return {Boolean}
*/
module.exports = function scmp(a, b) {
a = String(a);
b = String(b);
if (a.length !== b.length) {
return false;
}
var result = 0;
for (var i = 0; i < a.length; ++i) {
result |= a.charCodeAt(i) ^ b.charCodeAt(i);
}
return result === 0;
};

View File

@ -0,0 +1,54 @@
{
"name": "scmp",
"version": "0.0.3",
"description": "safe, constant-time string-comparison",
"main": "index.js",
"scripts": {
"test": "mocha",
"posttest": "matcha"
},
"repository": {
"type": "git",
"url": "git://github.com/freewil/scmp.git"
},
"keywords": [
"safe-compare",
"compare",
"time-equivalent-comparison",
"time equivalent",
"constant-time",
"constant time"
],
"author": {
"name": "Sean Lavine"
},
"license": "BSD",
"devDependencies": {
"mocha": "~1.13.0",
"matcha": "~0.4.0"
},
"bugs": {
"url": "https://github.com/freewil/scmp/issues"
},
"homepage": "https://github.com/freewil/scmp",
"_id": "scmp@0.0.3",
"dist": {
"shasum": "3648df2d7294641e7f78673ffc29681d9bad9073",
"tarball": "http://registry.npmjs.org/scmp/-/scmp-0.0.3.tgz"
},
"_from": "scmp@0.0.3",
"_npmVersion": "1.3.24",
"_npmUser": {
"name": "freewil",
"email": "sean@eternalrise.com"
},
"maintainers": [
{
"name": "freewil",
"email": "sean@eternalrise.com"
}
],
"directories": {},
"_shasum": "3648df2d7294641e7f78673ffc29681d9bad9073",
"_resolved": "https://registry.npmjs.org/scmp/-/scmp-0.0.3.tgz"
}

View File

@ -0,0 +1,24 @@
var scmp = require('../');
var assert = require('assert');
describe('scmp', function() {
it('should return true for identical strings', function() {
assert(scmp('a', 'a'));
assert(scmp('abc', 'abc'));
assert(scmp('e727d1464ae12436e899a726da5b2f11d8381b26', 'e727d1464ae12436e899a726da5b2f11d8381b26'));
});
it('should return false for non-identical strings', function() {
assert.ifError(scmp('a', 'b'));
assert.ifError(scmp('abc', 'b'));
assert.ifError(scmp('e727d1464ae12436e899a726da5b2f11d8381b26', 'e727e1b80e448a213b392049888111e1779a52db'));
});
it('should not throw errors for non-strings', function() {
assert.ifError(scmp('a', {}));
assert.ifError(scmp({}, 'b'));
assert.ifError(scmp(1, 2));
assert.ifError(scmp(undefined, 2));
assert.ifError(scmp(null, 2));
});
});

View File

@ -0,0 +1,2 @@
.DS_Store*
node_modules

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
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.

View File

@ -0,0 +1,44 @@
# UID Safe
Create cryptographically secure UIDs safe for both cookie and URL usage.
This is in contrast to modules such as [rand-token](https://github.com/sehrope/node-rand-token)
and [uid2](https://github.com/coreh/uid2) whose UIDs are actually skewed
due to the use of `%` and unnecessarily truncate the UID.
Use this if you could still use UIDs with `-` and `_` in them.
## API
```js
var uid = require('uid-safe')
```
### uid(byteLength, [cb])
Asynchronously create a UID with a specific byte length.
Because `base64` encoding is used underneath, this is not the string length!
For example, to create a UID of length 24, you want a byte length of 18!
If `cb` is not defined, a promise is returned.
However, to use promises, you must either install [bluebird](https://github.com/petkaantonov/bluebird)
or use a version of node.js that has native promises,
otherwise your process will crash and die.
```js
uid(18).then(function (string) {
// do something with the string
})
uid(18, function (err, string) {
if (err) throw err
// do something with the string
})
```
### uid.sync(byteLength)
A synchronous version of above.
```js
var string = uid.sync(18)
```

View File

@ -0,0 +1,27 @@
var pseudoRandomBytes = require('crypto').pseudoRandomBytes
var escape = require('base64-url').escape
var pseudoRandomBytesProm
module.exports = uid
function uid(length, cb) {
if (cb) {
return pseudoRandomBytes(length, function (err, buf) {
if (err) return cb(err)
cb(null, escapeBuffer(buf))
})
}
pseudoRandomBytesProm || (pseudoRandomBytesProm = require('mz/crypto').pseudoRandomBytes)
return pseudoRandomBytesProm(length).then(escapeBuffer)
}
uid.sync = function uid_sync(length) {
return escapeBuffer(pseudoRandomBytes(length))
}
function escapeBuffer(buf) {
return escape(buf.toString('base64'))
}

View File

@ -0,0 +1 @@
test

View File

@ -0,0 +1,7 @@
node_js:
- "0.8"
- "0.10"
- "0.11"
language: node_js
script: "npm run test-travis"
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

View File

@ -0,0 +1,6 @@
1.0.0 / 2014-06-18
==================
* use `bluebird` by default if found
* support node 0.8

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
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.

View File

@ -0,0 +1,114 @@
# MZ - Modernize node.js
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![Gittip][gittip-image]][gittip-url]
Modernize node.js to current ECMAScript specifications!
node.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549).
This library is a wrapper for various aspects of node.js' API.
## Installation and Usage
Set `mz` as a dependency and install it.
```bash
npm i mz
```
Then prefix the relevant `require()`s with `mz/`:
```js
var fs = require('mz/fs')
fs.exists(__filename).then(function (exists) {
if (exists) // do something
})
```
Personally, I use this with generator-based control flow libraries such as [co](https://github.com/visionmedia/co) so I don't need to use implementation-specific wrappers like [co-fs](https://github.com/visionmedia/co-fs).
```js
var co = require('co')
var fs = require('mz/fs')
co(function* () {
if (yield fs.exists(__filename)) // do something
})()
```
## Promisification
Many node methods are converted into promises.
Any properties that are deprecated or aren't asynchronous will simply be proxied.
The modules wrapped are:
- `child_process`
- `crypto`
- `dns`
- `fs`
- `zlib`
```js
var exec = require('mz/child_process').exec
exec('node --version').then(function (stdout) {
console.log(stdout)
})
```
## Promise Engine
If you've installed [bluebird][bluebird],
[bluebird][bluebird] will be used.
`mz` does not install [bluebird][bluebird] for you.
Otherwise, if you're using a node that has native v8 Promises (v0.11.13+),
then that will be used.
Otherwise, this library will crash the process and exit,
so you might as well install [bluebird][bluebird] as a dependency!
## FAQ
### Can I use this in production?
If you do, you should probably install [bluebird][bluebird] as
native v8 promises are still pretty raw.
### Will this make my app faster?
Nope, probably slower actually.
### Can I add more features?
Sure.
Open an issue.
Currently, the plans are to eventually support:
- ECMAScript7 Streams
[bluebird]: https://github.com/petkaantonov/bluebird
[npm-image]: https://img.shields.io/npm/v/mz.svg?style=flat-square
[npm-url]: https://npmjs.org/package/mz
[github-tag]: http://img.shields.io/github/tag/normalize/mz.svg?style=flat-square
[github-url]: https://github.com/normalize/mz/tags
[travis-image]: https://img.shields.io/travis/normalize/mz.svg?style=flat-square
[travis-url]: https://travis-ci.org/normalize/mz
[coveralls-image]: https://img.shields.io/coveralls/normalize/mz.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/normalize/mz?branch=master
[david-image]: http://img.shields.io/david/normalize/mz.svg?style=flat-square
[david-url]: https://david-dm.org/normalize/mz
[license-image]: http://img.shields.io/npm/l/mz.svg?style=flat-square
[license-url]: LICENSE.md
[downloads-image]: http://img.shields.io/npm/dm/mz.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/mz
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
[gittip-url]: https://www.gittip.com/jonathanong/

View File

@ -0,0 +1,34 @@
var Promise = require('native-or-bluebird')
module.exports = function mz_promisify(name, fn) {
return eval('(function ' + name + '() {\n'
+ 'var len = arguments.length\n'
+ 'var args = new Array(len + 1)\n'
+ 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\n'
+ 'var lastIndex = i\n'
+ 'return new Promise(function (resolve, reject) {\n'
+ 'args[lastIndex] = makeCallback(resolve, reject)\n'
+ 'fn.apply(null, args)\n'
+ '})\n'
+ '})')
}
function makeCallback(resolve, reject) {
return function(err, value) {
if (err) {
reject(err)
} else {
var len = arguments.length
if (len > 2) {
var values = new Array(len - 1)
for (var i = 1; i < len; ++i) {
values[i - 1] = arguments[i]
}
resolve(values)
} else {
resolve(value)
}
}
}
}

View File

@ -0,0 +1,24 @@
var promisify = require('./_promisify.js')
module.exports = function (source, exports, methods) {
methods.forEach(function (name) {
if (deprecated(source, name)) return
if (typeof source[name] === 'function')
exports[name] = promisify(name, source[name])
})
// proxy the rest
Object.keys(source).forEach(function (name) {
if (deprecated(source, name)) return
if (exports[name]) return
exports[name] = source[name]
})
}
function deprecated(source, name) {
var desc = Object.getOwnPropertyDescriptor(source, name)
if (!desc || !desc.get) return false
if (desc.get.name === 'deprecated') return true
return false
}

View File

@ -0,0 +1,8 @@
require('./_promisify_all')(
require('child_process'),
exports, [
'exec',
'execFile',
]
)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,350 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8">
<link rel="stylesheet" href="prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">All files</span></h1>
<h2>
Statements: <span class="metric">95.35% <small>(41 / 43)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">83.33% <small>(15 / 18)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(9 / 9)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">97.37% <small>(37 / 38)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"></div>
</div>
<div class="body">
<div class="coverage-summary">
<table>
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="mz/"><a href="mz/index.html">mz/</a></td>
<td data-value="95.35" class="pic high"><span class="cover-fill" style="width: 95px;"></span><span class="cover-empty" style="width:5px;"></span></td>
<td data-value="95.35" class="pct high">95.35%</td>
<td data-value="43" class="abs high">(41&nbsp;/&nbsp;43)</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="18" class="abs high">(15&nbsp;/&nbsp;18)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="9" class="abs high">(9&nbsp;/&nbsp;9)</td>
<td data-value="97.37" class="pct high">97.37%</td>
<td data-value="38" class="abs high">(37&nbsp;/&nbsp;38)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,424 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/_promisify.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/_promisify.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(14 / 14)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(4 / 4)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(3 / 3)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(14 / 14)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">mz/</a> &#187; _promisify.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">45</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&nbsp;
var Promise = require('native-or-bluebird')
&nbsp;
module.exports = function mz_promisify(name, fn) {
return eval('(function ' + name + '() {\n'
+ 'var len = arguments.length\n'
+ 'var args = new Array(len + 1)\n'
+ 'for (var i = 0; i &lt; len; ++i) args[i] = arguments[i]\n'
+ 'var lastIndex = i\n'
+ 'return new Promise(function (resolve, reject) {\n'
+ 'args[lastIndex] = makeCallback(resolve, reject)\n'
+ 'fn.apply(null, args)\n'
+ '})\n'
+ '})')
}
&nbsp;
function makeCallback(resolve, reject) {
return function(err, value) {
if (err) {
reject(err)
} else {
var len = arguments.length
if (len &gt; 2) {
var values = new Array(len - 1)
for (var i = 1; i &lt; len; ++i) {
values[i - 1] = arguments[i]
}
resolve(values)
} else {
resolve(value)
}
}
}
}
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,394 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/_promisify_all.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/_promisify_all.js</span></h1>
<h2>
Statements: <span class="metric">90% <small>(18 / 20)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">78.57% <small>(11 / 14)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(4 / 4)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">93.33% <small>(14 / 15)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">mz/</a> &#187; _promisify_all.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-yes">40</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">189</span>
<span class="cline-any cline-yes">187</span>
<span class="cline-any cline-yes">147</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-yes">229</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&nbsp;
var promisify = require('./_promisify.js')
&nbsp;
module.exports = function (source, exports, methods) {
methods.forEach(function (name) {
<span class="missing-if-branch" title="if path not taken" >I</span>if (deprecated(source, name)) <span class="cstat-no" title="statement not covered" >return</span>
<span class="missing-if-branch" title="else path not taken" >E</span>if (typeof source[name] === 'function')
exports[name] = promisify(name, source[name])
})
&nbsp;
// proxy the rest
Object.keys(source).forEach(function (name) {
if (deprecated(source, name)) return
if (exports[name]) return
exports[name] = source[name]
})
}
&nbsp;
function deprecated(source, name) {
var desc = Object.getOwnPropertyDescriptor(source, name)
if (!desc || !desc.get) return false
<span class="missing-if-branch" title="else path not taken" >E</span>if (desc.get.name === 'deprecated') return true
<span class="cstat-no" title="statement not covered" > return false</span>
}
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,346 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/child_process.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/child_process.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">mz/</a> &#187; child_process.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&nbsp;
require('./_promisify_all')(
require('child_process'),
exports, [
'exec',
'execFile',
]
)
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,349 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/crypto.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/crypto.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">mz/</a> &#187; crypto.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&nbsp;
require('./_promisify_all')(
require('crypto'),
exports, [
'pbkdf2',
'randomBytes',
'pseudoRandomBytes',
]
)
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,448 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/fs.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/fs.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(6 / 6)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(2 / 2)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(6 / 6)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">mz/</a> &#187; fs.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&nbsp;
var fs = require('fs')
&nbsp;
require('./_promisify_all.js')(fs, exports, [
'rename',
'ftruncate',
'chown',
'fchown',
'lchown',
'chmod',
'fchmod',
'stat',
'lstat',
'fstat',
'link',
'symlink',
'readlink',
'realpath',
'unlink',
'rmdir',
'mkdir',
'readdir',
'close',
'open',
'utimes',
'futimes',
'fsync',
'write',
'read',
'readFile',
'writeFile',
'appendFile',
])
&nbsp;
var promisify = require('./_promisify.js')
&nbsp;
// don't know enough about promises to do this haha
exports.exists = promisify('exists', function exists(filename, done) {
fs.stat(filename, function (err) {
done(null, !err)
})
})
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,415 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/</span></h1>
<h2>
Statements: <span class="metric">95.35% <small>(41 / 43)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">83.33% <small>(15 / 18)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(9 / 9)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">97.37% <small>(37 / 38)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; mz/</div>
</div>
<div class="body">
<div class="coverage-summary">
<table>
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="_promisify.js"><a href="_promisify.js.html">_promisify.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">(14&nbsp;/&nbsp;14)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">(4&nbsp;/&nbsp;4)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">(3&nbsp;/&nbsp;3)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">(14&nbsp;/&nbsp;14)</td>
</tr>
<tr>
<td class="file high" data-value="_promisify_all.js"><a href="_promisify_all.js.html">_promisify_all.js</a></td>
<td data-value="90" class="pic high"><span class="cover-fill" style="width: 90px;"></span><span class="cover-empty" style="width:10px;"></span></td>
<td data-value="90" class="pct high">90%</td>
<td data-value="20" class="abs high">(18&nbsp;/&nbsp;20)</td>
<td data-value="78.57" class="pct medium">78.57%</td>
<td data-value="14" class="abs medium">(11&nbsp;/&nbsp;14)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">(4&nbsp;/&nbsp;4)</td>
<td data-value="93.33" class="pct high">93.33%</td>
<td data-value="15" class="abs high">(14&nbsp;/&nbsp;15)</td>
</tr>
<tr>
<td class="file high" data-value="child_process.js"><a href="child_process.js.html">child_process.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
</tr>
<tr>
<td class="file high" data-value="crypto.js"><a href="crypto.js.html">crypto.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
</tr>
<tr>
<td class="file high" data-value="fs.js"><a href="fs.js.html">fs.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">(6&nbsp;/&nbsp;6)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">(2&nbsp;/&nbsp;2)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">(6&nbsp;/&nbsp;6)</td>
</tr>
<tr>
<td class="file high" data-value="zlib.js"><a href="zlib.js.html">zlib.js</a></td>
<td data-value="100" class="pic high"><span class="cover-fill cover-full" style="width: 100px;"></span><span class="cover-empty" style="width:0px;"></span></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">(0&nbsp;/&nbsp;0)</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">(1&nbsp;/&nbsp;1)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,361 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for mz/zlib.js</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../prettify.css">
<style>
body, html {
margin:0; padding: 0;
}
body {
font-family: Helvetica Neue, Helvetica,Arial;
font-size: 10pt;
}
div.header, div.footer {
background: #eee;
padding: 1em;
}
div.header {
z-index: 100;
position: fixed;
top: 0;
border-bottom: 1px solid #666;
width: 100%;
}
div.footer {
border-top: 1px solid #666;
}
div.body {
margin-top: 10em;
}
div.meta {
font-size: 90%;
text-align: center;
}
h1, h2, h3 {
font-weight: normal;
}
h1 {
font-size: 12pt;
}
h2 {
font-size: 10pt;
}
pre {
font-family: Consolas, Menlo, Monaco, monospace;
margin: 0;
padding: 0;
line-height: 14px;
font-size: 14px;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
div.path { font-size: 110%; }
div.path a:link, div.path a:visited { color: #000; }
table.coverage { border-collapse: collapse; margin:0; padding: 0 }
table.coverage td {
margin: 0;
padding: 0;
color: #111;
vertical-align: top;
}
table.coverage td.line-count {
width: 50px;
text-align: right;
padding-right: 5px;
}
table.coverage td.line-coverage {
color: #777 !important;
text-align: right;
border-left: 1px solid #666;
border-right: 1px solid #666;
}
table.coverage td.text {
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 40px;
}
table.coverage td span.cline-neutral {
background: #eee;
}
table.coverage td span.cline-yes {
background: #b5d592;
color: #999;
}
table.coverage td span.cline-no {
background: #fc8c84;
}
.cstat-yes { color: #111; }
.cstat-no { background: #fc8c84; color: #111; }
.fstat-no { background: #ffc520; color: #111 !important; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
.missing-if-branch {
display: inline-block;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: black;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.entity, .metric { font-weight: bold; }
.metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
.metric small { font-size: 80%; font-weight: normal; color: #666; }
div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
div.coverage-summary th.file { border-right: none !important; }
div.coverage-summary th.pic { border-left: none !important; text-align: right; }
div.coverage-summary th.pct { border-right: none !important; }
div.coverage-summary th.abs { border-left: none !important; text-align: right; }
div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; }
div.coverage-summary td.pic { min-width: 120px !important; }
div.coverage-summary a:link { text-decoration: none; color: #000; }
div.coverage-summary a:visited { text-decoration: none; color: #333; }
div.coverage-summary a:hover { text-decoration: underline; }
div.coverage-summary tfoot td { border-top: 1px solid #666; }
div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
}
div.coverage-summary .yui3-datatable-sort-indicator {
background: url("https://yui-s.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
}
div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
background-position: 0 -20px;
}
div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
background-position: 0 -10px;
}
.high { background: #b5d592 !important; }
.medium { background: #ffe87c !important; }
.low { background: #fc8c84 !important; }
span.cover-fill, span.cover-empty {
display:inline-block;
border:1px solid #444;
background: white;
height: 12px;
}
span.cover-fill {
background: #ccc;
border-right: 1px solid #444;
}
span.cover-empty {
background: white;
border-left: none;
}
span.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
</style>
</head>
<body>
<div class="header high">
<h1>Code coverage report for <span class="entity">mz/zlib.js</span></h1>
<h2>
Statements: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Branches: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Functions: <span class="metric">100% <small>(0 / 0)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Lines: <span class="metric">100% <small>(1 / 1)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
</h2>
<div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">mz/</a> &#187; zlib.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&nbsp;
require('./_promisify_all')(
require('zlib'),
exports, [
'deflate',
'deflateRaw',
'gzip',
'gunzip',
'inflate',
'inflateRaw',
'unzip',
]
)
&nbsp;</pre></td></tr>
</table></pre>
</div>
<div class="footer">
<div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Aug 18 2014 01:32:02 GMT-0700 (PDT)</div>
</div>
<script src="../prettify.js"></script>
<script src="https://yui-s.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>
YUI().use('datatable', function (Y) {
var formatters = {
pct: function (o) {
o.className += o.record.get('classes')[o.column.key];
try {
return o.value.toFixed(2) + '%';
} catch (ex) { return o.value + '%'; }
},
html: function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.record.get(o.column.key + '_html');
}
},
defaultFormatter = function (o) {
o.className += o.record.get('classes')[o.column.key];
return o.value;
};
function getColumns(theadNode) {
var colNodes = theadNode.all('tr th'),
cols = [],
col;
colNodes.each(function (colNode) {
col = {
key: colNode.getAttribute('data-col'),
label: colNode.get('innerHTML') || ' ',
sortable: !colNode.getAttribute('data-nosort'),
className: colNode.getAttribute('class'),
type: colNode.getAttribute('data-type'),
allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
};
col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
cols.push(col);
});
return cols;
}
function getRowData(trNode, cols) {
var tdNodes = trNode.all('td'),
i,
row = { classes: {} },
node,
name;
for (i = 0; i < cols.length; i += 1) {
name = cols[i].key;
node = tdNodes.item(i);
row[name] = node.getAttribute('data-value') || node.get('innerHTML');
row[name + '_html'] = node.get('innerHTML');
row.classes[name] = node.getAttribute('class');
//Y.log('Name: ' + name + '; Value: ' + row[name]);
if (cols[i].type === 'number') { row[name] = row[name] * 1; }
}
//Y.log(row);
return row;
}
function getData(tbodyNode, cols) {
var data = [];
tbodyNode.all('tr').each(function (trNode) {
data.push(getRowData(trNode, cols));
});
return data;
}
function replaceTable(node) {
if (!node) { return; }
var cols = getColumns(node.one('thead')),
data = getData(node.one('tbody'), cols),
table,
parent = node.get('parentNode');
table = new Y.DataTable({
columns: cols,
data: data,
sortBy: 'file'
});
parent.set('innerHTML', '');
table.render(parent);
}
Y.on('domready', function () {
replaceTable(Y.one('div.coverage-summary table'));
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,128 @@
TN:
SF:/Users/jong/Workspace/mz/fs.js
FN:38,exists
FN:39,(anonymous_2)
FNF:2
FNH:2
FNDA:1,exists
FNDA:1,(anonymous_2)
DA:2,1
DA:4,1
DA:35,1
DA:38,1
DA:39,1
DA:40,1
LF:6
LH:6
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/jong/Workspace/mz/_promisify_all.js
FN:4,(anonymous_1)
FN:5,(anonymous_2)
FN:12,(anonymous_3)
FN:19,deprecated
FNF:4
FNH:4
FNDA:4,(anonymous_1)
FNDA:40,(anonymous_2)
FNDA:189,(anonymous_3)
FNDA:229,deprecated
DA:2,1
DA:4,1
DA:5,4
DA:6,40
DA:7,40
DA:8,40
DA:12,4
DA:13,189
DA:14,187
DA:15,147
DA:19,1
DA:20,229
DA:21,229
DA:22,2
DA:23,0
LF:15
LH:14
BRDA:6,1,0,0
BRDA:6,1,1,40
BRDA:7,2,0,40
BRDA:7,2,1,0
BRDA:13,3,0,2
BRDA:13,3,1,187
BRDA:14,4,0,40
BRDA:14,4,1,147
BRDA:21,5,0,227
BRDA:21,5,1,2
BRDA:21,6,0,229
BRDA:21,6,1,229
BRDA:22,7,0,2
BRDA:22,7,1,0
BRF:14
BRH:11
end_of_record
TN:
SF:/Users/jong/Workspace/mz/_promisify.js
FN:4,mz_promisify
FN:17,makeCallback
FN:18,(anonymous_3)
FNF:3
FNH:3
FNDA:45,mz_promisify
FNDA:10,makeCallback
FNDA:10,(anonymous_3)
DA:2,1
DA:4,1
DA:5,45
DA:17,1
DA:18,10
DA:19,10
DA:20,3
DA:22,7
DA:23,7
DA:24,1
DA:25,1
DA:26,2
DA:28,1
DA:30,6
LF:14
LH:14
BRDA:19,1,0,3
BRDA:19,1,1,7
BRDA:23,2,0,1
BRDA:23,2,1,6
BRF:4
BRH:4
end_of_record
TN:
SF:/Users/jong/Workspace/mz/child_process.js
FNF:0
FNH:0
DA:2,1
LF:1
LH:1
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/jong/Workspace/mz/crypto.js
FNF:0
FNH:0
DA:2,1
LF:1
LH:1
BRF:0
BRH:0
end_of_record
TN:
SF:/Users/jong/Workspace/mz/zlib.js
FNF:0
FNH:0
DA:2,1
LF:1
LH:1
BRF:0
BRH:0
end_of_record

View File

@ -0,0 +1,9 @@
require('./_promisify_all')(
require('crypto'),
exports, [
'pbkdf2',
'randomBytes',
'pseudoRandomBytes',
]
)

View File

@ -0,0 +1,16 @@
require('./_promisify_all')(
require('dns'),
exports, [
'lookup',
'resolve',
'resolve4',
'resolve6',
'resolveMx',
'resolveTxt',
'resolveSrv',
'resolveNs',
'resolveCname',
'reverse',
]
)

View File

@ -0,0 +1,42 @@
var fs = require('fs')
require('./_promisify_all.js')(fs, exports, [
'rename',
'ftruncate',
'chown',
'fchown',
'lchown',
'chmod',
'fchmod',
'stat',
'lstat',
'fstat',
'link',
'symlink',
'readlink',
'realpath',
'unlink',
'rmdir',
'mkdir',
'readdir',
'close',
'open',
'utimes',
'futimes',
'fsync',
'write',
'read',
'readFile',
'writeFile',
'appendFile',
])
var promisify = require('./_promisify.js')
// don't know enough about promises to do this haha
exports.exists = promisify('exists', function exists(filename, done) {
fs.stat(filename, function (err) {
done(null, !err)
})
})

View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
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.

View File

@ -0,0 +1,48 @@
# native-or-bluebird
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![Gittip][gittip-image]][gittip-url]
Use either `bluebird` or the native `Promise` implementation.
If no implementation is found, an error will be thrown:
```js
var Promise = require('native-or-bluebird');
```
The goal of this library is to be able to eventually remove this line
from your code and use native `Promise`s, allowing you to
to write future-compatible code with ease.
You should install `bluebird` in your libraries for maximum compatibility.
If you do not want an error to be thrown,
`require()` the `Promise` implementation directly.
If no implementation is found, `undefined` will be returned.
```js
var Promise = require('native-or-bluebird/promise');
if (Promise) // do stuff with promises
```
[npm-image]: https://img.shields.io/npm/v/native-or-bluebird.svg?style=flat-square
[npm-url]: https://npmjs.org/package/native-or-bluebird
[github-tag]: http://img.shields.io/github/tag/normalize/native-or-bluebird.svg?style=flat-square
[github-url]: https://github.com/normalize/native-or-bluebird/tags
[travis-image]: https://img.shields.io/travis/normalize/native-or-bluebird.svg?style=flat-square
[travis-url]: https://travis-ci.org/normalize/native-or-bluebird
[coveralls-image]: https://img.shields.io/coveralls/normalize/native-or-bluebird.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/normalize/native-or-bluebird?branch=master
[david-image]: http://img.shields.io/david/normalize/native-or-bluebird.svg?style=flat-square
[david-url]: https://david-dm.org/normalize/native-or-bluebird
[license-image]: http://img.shields.io/npm/l/native-or-bluebird.svg?style=flat-square
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/native-or-bluebird.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/native-or-bluebird
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
[gittip-url]: https://www.gittip.com/jonathanong/

View File

@ -0,0 +1,9 @@
module.exports = require('./promise')
/* istanbul ignore next */
if (!module.exports) {
console.error('Neither `bluebird` nor the native `Promise` functions were found.')
console.error('Please install `bluebird` yourself.')
process.exit(1)
}

View File

@ -0,0 +1,65 @@
{
"name": "native-or-bluebird",
"description": "use either the native Promise or Bluebird",
"version": "1.1.1",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/normalize/native-or-bluebird"
},
"keywords": [
"bluebird",
"promise",
"promises"
],
"devDependencies": {
"bluebird": "*",
"istanbul": "0",
"mocha": "1"
},
"scripts": {
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
},
"files": [
"index.js",
"promise.js",
"LICENSE"
],
"gitHead": "fc9ac96f8915371fa1ba3ad5efc84909e5c8f2de",
"bugs": {
"url": "https://github.com/normalize/native-or-bluebird/issues"
},
"homepage": "https://github.com/normalize/native-or-bluebird",
"_id": "native-or-bluebird@1.1.1",
"_shasum": "9131a6d6532afdfb5635f9703734cc6652c905ee",
"_from": "native-or-bluebird@1",
"_npmVersion": "1.4.21",
"_npmUser": {
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
"maintainers": [
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
{
"name": "swatinem",
"email": "arpad.borsos@googlemail.com"
}
],
"dist": {
"shasum": "9131a6d6532afdfb5635f9703734cc6652c905ee",
"tarball": "http://registry.npmjs.org/native-or-bluebird/-/native-or-bluebird-1.1.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/native-or-bluebird/-/native-or-bluebird-1.1.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@ -0,0 +1,8 @@
module.exports = global.Promise
if (!module.exports) {
try {
module.exports = require('bluebird')
} catch (_) {}
}

View File

@ -0,0 +1,58 @@
{
"name": "mz",
"description": "modernize node.js to current ECMAScript standards",
"version": "1.0.1",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/normalize/mz"
},
"dependencies": {
"native-or-bluebird": "1"
},
"devDependencies": {
"istanbul": "0",
"bluebird": "2",
"mocha": "1"
},
"scripts": {
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
},
"gitHead": "e6bd4cb4d0e0b3176638184a38dd54ca9f6f547c",
"bugs": {
"url": "https://github.com/normalize/mz/issues"
},
"homepage": "https://github.com/normalize/mz",
"_id": "mz@1.0.1",
"_shasum": "5ce1d3fe5cb3267c9c3141fb6a070f8d17f215d8",
"_from": "mz@1",
"_npmVersion": "1.4.21",
"_npmUser": {
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
"maintainers": [
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
{
"name": "swatinem",
"email": "arpad.borsos@googlemail.com"
}
],
"dist": {
"shasum": "5ce1d3fe5cb3267c9c3141fb6a070f8d17f215d8",
"tarball": "http://registry.npmjs.org/mz/-/mz-1.0.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/mz/-/mz-1.0.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@ -0,0 +1,13 @@
require('./_promisify_all')(
require('zlib'),
exports, [
'deflate',
'deflateRaw',
'gzip',
'gunzip',
'inflate',
'inflateRaw',
'unzip',
]
)

View File

@ -0,0 +1,59 @@
{
"name": "uid-safe",
"description": "URL and cookie safe UIDs",
"version": "1.0.1",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/crypto-utils/uid-safe"
},
"dependencies": {
"mz": "1",
"base64-url": "1"
},
"devDependencies": {
"bluebird": "2",
"mocha": "1"
},
"scripts": {
"test": "mocha --reporter spec --bail"
},
"bugs": {
"url": "https://github.com/crypto-utils/uid-safe/issues"
},
"homepage": "https://github.com/crypto-utils/uid-safe",
"_id": "uid-safe@1.0.1",
"_shasum": "5bd148460a2e84f54f193fd20352c8c3d7de6ac8",
"_from": "uid-safe@~1.0.1",
"_npmVersion": "1.4.9",
"_npmUser": {
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
"maintainers": [
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
{
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
{
"name": "fishrock123",
"email": "fishrock123@rocketmail.com"
}
],
"dist": {
"shasum": "5bd148460a2e84f54f193fd20352c8c3d7de6ac8",
"tarball": "http://registry.npmjs.org/uid-safe/-/uid-safe-1.0.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-1.0.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@ -0,0 +1,46 @@
var assert = require('assert')
var uid = require('./')
describe('uid-url', function () {
describe('uid()', function () {
it('should return a uid of the correct length', function () {
return uid(18).then(function (val) {
assert.equal(24, Buffer.byteLength(val))
})
})
it('should not contain +, /, or =', function () {
return uid(100000).then(function (val) {
assert(!~val.indexOf('+'))
assert(!~val.indexOf('/'))
assert(!~val.indexOf('='))
})
})
it('should support callbacks', function (done) {
uid(1000000, function (err, val) {
if (err) return done(err)
assert(!~val.indexOf('+'))
assert(!~val.indexOf('/'))
assert(!~val.indexOf('='))
done()
})
})
})
describe('uid.sync()', function () {
it('should return a uid of the correct length', function () {
var val = uid.sync(18)
assert.equal(24, Buffer.byteLength(val))
})
it('should not contain +, /, or =', function () {
var val = uid.sync(100000)
assert(!~val.indexOf('+'))
assert(!~val.indexOf('/'))
assert(!~val.indexOf('='))
})
})
})

67
node_modules/csurf/node_modules/csrf/package.json generated vendored Normal file
View File

@ -0,0 +1,67 @@
{
"name": "csrf",
"description": "primary logic behind csrf tokens",
"version": "2.0.1",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pillarjs/csrf"
},
"dependencies": {
"rndm": "~1.0.0",
"scmp": "0.0.3",
"uid-safe": "~1.0.1",
"base64-url": "1.0.0"
},
"devDependencies": {
"istanbul": "0",
"bluebird": "2",
"mocha": "1"
},
"scripts": {
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
},
"keywords": [
"csrf",
"tokens"
],
"files": [
"index.js"
],
"gitHead": "d23024ade7607942a2236ec0ae5903396f610db0",
"bugs": {
"url": "https://github.com/pillarjs/csrf/issues"
},
"homepage": "https://github.com/pillarjs/csrf",
"_id": "csrf@2.0.1",
"_shasum": "d673a2efb4db7d0e6805dadd838c57e30ae0ee73",
"_from": "csrf@~2.0.1",
"_npmVersion": "1.4.21",
"_npmUser": {
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
"maintainers": [
{
"name": "dwolla",
"email": "michael@dwolla.com"
},
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
}
],
"dist": {
"shasum": "d673a2efb4db7d0e6805dadd838c57e30ae0ee73",
"tarball": "http://registry.npmjs.org/csrf/-/csrf-2.0.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/csrf/-/csrf-2.0.1.tgz"
}

100
node_modules/csurf/package.json generated vendored Normal file
View File

@ -0,0 +1,100 @@
{
"name": "csurf",
"description": "CSRF token middleware",
"version": "1.6.1",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
}
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/expressjs/csurf"
},
"dependencies": {
"cookie": "0.1.2",
"cookie-signature": "1.0.5",
"csrf": "~2.0.1"
},
"devDependencies": {
"body-parser": "~1.8.0",
"connect": "3",
"cookie-parser": "~1.3.3",
"cookie-session": "~1.0.2",
"istanbul": "0.3.2",
"mocha": "~1.21.3",
"should": "~4.0.4",
"supertest": "~0.13.0"
},
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "mocha --check-leaks --reporter spec --bail test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/"
},
"files": [
"HISTORY.md",
"LICENSE",
"index.js"
],
"keywords": [
"csrf",
"tokens",
"middleware",
"express"
],
"gitHead": "fb69d592c265764184744dd764d878a6dc83bd0c",
"bugs": {
"url": "https://github.com/expressjs/csurf/issues"
},
"homepage": "https://github.com/expressjs/csurf",
"_id": "csurf@1.6.1",
"_shasum": "78da376f016bcaa48275d553d133585e478f4054",
"_from": "csurf@",
"_npmVersion": "1.4.21",
"_npmUser": {
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
"maintainers": [
{
"name": "jongleberry",
"email": "jonathanrichardong@gmail.com"
},
{
"name": "dougwilson",
"email": "doug@somethingdoug.com"
},
{
"name": "shtylman",
"email": "shtylman@gmail.com"
},
{
"name": "tjholowaychuk",
"email": "tj@vision-media.ca"
},
{
"name": "mscdex",
"email": "mscdex@mscdex.net"
},
{
"name": "fishrock123",
"email": "fishrock123@rocketmail.com"
}
],
"dist": {
"shasum": "78da376f016bcaa48275d553d133585e478f4054",
"tarball": "http://registry.npmjs.org/csurf/-/csurf-1.6.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/csurf/-/csurf-1.6.1.tgz"
}

13
node_modules/express/History.md generated vendored
View File

@ -1,3 +1,9 @@
4.9.4 / 2014-09-19
==================
* deps: qs@2.2.4
- Fix issue with object keys starting with numbers truncated
4.9.3 / 2014-09-18 4.9.3 / 2014-09-18
================== ==================
@ -493,6 +499,13 @@
- `app.route()` - Proxy to the app's `Router#route()` method to create a new route - `app.route()` - Proxy to the app's `Router#route()` method to create a new route
- Router & Route - public API - Router & Route - public API
3.17.4 / 2014-09-19
===================
* deps: connect@2.26.2
- deps: body-parser@~1.8.3
- deps: qs@2.2.4
3.17.3 / 2014-09-18 3.17.3 / 2014-09-18
=================== ===================

View File

@ -52,7 +52,7 @@
"homepage": "https://github.com/jshttp/mime-db", "homepage": "https://github.com/jshttp/mime-db",
"_id": "mime-db@1.0.1", "_id": "mime-db@1.0.1",
"_shasum": "35d99b0965967253bb30633a7d07a8de9975a952", "_shasum": "35d99b0965967253bb30633a7d07a8de9975a952",
"_from": "mime-db@~1.0.1", "_from": "mime-db@>=1.0.1 <1.1.0",
"_npmVersion": "1.4.21", "_npmVersion": "1.4.21",
"_npmUser": { "_npmUser": {
"name": "jongleberry", "name": "jongleberry",

View File

@ -50,7 +50,7 @@
"homepage": "https://github.com/jshttp/mime-types", "homepage": "https://github.com/jshttp/mime-types",
"_id": "mime-types@2.0.1", "_id": "mime-types@2.0.1",
"_shasum": "7f5b4712592e7dd46ca733fd1c5f5d71356de615", "_shasum": "7f5b4712592e7dd46ca733fd1c5f5d71356de615",
"_from": "mime-types@~2.0.1", "_from": "mime-types@>=2.0.1 <2.1.0",
"_npmVersion": "1.4.21", "_npmVersion": "1.4.21",
"_npmUser": { "_npmUser": {
"name": "dougwilson", "name": "dougwilson",

View File

@ -62,5 +62,6 @@
], ],
"directories": {}, "directories": {},
"_shasum": "a4160f7177ec806738631d0d3052325da42abdc8", "_shasum": "a4160f7177ec806738631d0d3052325da42abdc8",
"_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.7.tgz" "_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.7.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -45,7 +45,7 @@
"homepage": "https://github.com/jshttp/accepts", "homepage": "https://github.com/jshttp/accepts",
"_id": "accepts@1.1.0", "_id": "accepts@1.1.0",
"_shasum": "43ba6d946374c80f91823eaec6bb43dc4955500b", "_shasum": "43ba6d946374c80f91823eaec6bb43dc4955500b",
"_from": "accepts@~1.1.0", "_from": "accepts@>=1.1.0 <1.2.0",
"_npmVersion": "1.4.21", "_npmVersion": "1.4.21",
"_npmUser": { "_npmUser": {
"name": "jongleberry", "name": "jongleberry",

View File

@ -53,5 +53,6 @@
"tarball": "http://registry.npmjs.org/crc/-/crc-3.0.0.tgz" "tarball": "http://registry.npmjs.org/crc/-/crc-3.0.0.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/crc/-/crc-3.0.0.tgz" "_resolved": "https://registry.npmjs.org/crc/-/crc-3.0.0.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -53,7 +53,7 @@
"homepage": "https://github.com/jshttp/etag", "homepage": "https://github.com/jshttp/etag",
"_id": "etag@1.3.1", "_id": "etag@1.3.1",
"_shasum": "e51925728688a32dc4eea1cfa9ab4f734d055567", "_shasum": "e51925728688a32dc4eea1cfa9ab4f734d055567",
"_from": "etag@~1.3.1", "_from": "etag@>=1.3.1 <1.4.0",
"_npmVersion": "1.4.21", "_npmVersion": "1.4.21",
"_npmUser": { "_npmUser": {
"name": "dougwilson", "name": "dougwilson",
@ -70,5 +70,6 @@
"tarball": "http://registry.npmjs.org/etag/-/etag-1.3.1.tgz" "tarball": "http://registry.npmjs.org/etag/-/etag-1.3.1.tgz"
}, },
"directories": {}, "directories": {},
"_resolved": "https://registry.npmjs.org/etag/-/etag-1.3.1.tgz" "_resolved": "https://registry.npmjs.org/etag/-/etag-1.3.1.tgz",
"readme": "ERROR: No README data found!"
} }

View File

@ -1,3 +0,0 @@
{
"laxbreak": true
}

View File

@ -1,150 +0,0 @@
2.0.0 / 2014-09-01
==================
* package: update "browserify" to v5.11.0
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
1.0.4 / 2014-07-15
==================
* dist: recompile
* example: remove `console.info()` log usage
* example: add "Content-Type" UTF-8 header to browser example
* browser: place %c marker after the space character
* browser: reset the "content" color via `color: inherit`
* browser: add colors support for Firefox >= v31
* debug: prefer an instance `log()` function over the global one (#119)
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
1.0.3 / 2014-07-09
==================
* Add support for multiple wildcards in namespaces (#122, @seegno)
* browser: fix lint
1.0.2 / 2014-06-10
==================
* browser: update color palette (#113, @gscottolson)
* common: make console logging function configurable (#108, @timoxley)
* node: fix %o colors on old node <= 0.8.x
* Makefile: find node path using shell/which (#109, @timoxley)
1.0.1 / 2014-06-06
==================
* browser: use `removeItem()` to clear localStorage
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
* package: add "contributors" section
* node: fix comment typo
* README: list authors
1.0.0 / 2014-06-04
==================
* make ms diff be global, not be scope
* debug: ignore empty strings in enable()
* node: make DEBUG_COLORS able to disable coloring
* *: export the `colors` array
* npmignore: don't publish the `dist` dir
* Makefile: refactor to use browserify
* package: add "browserify" as a dev dependency
* Readme: add Web Inspector Colors section
* node: reset terminal color for the debug content
* node: map "%o" to `util.inspect()`
* browser: map "%j" to `JSON.stringify()`
* debug: add custom "formatters"
* debug: use "ms" module for humanizing the diff
* Readme: add "bash" syntax highlighting
* browser: add Firebug color support
* browser: add colors for WebKit browsers
* node: apply log to `console`
* rewrite: abstract common logic for Node & browsers
* add .jshintrc file
0.8.1 / 2014-04-14
==================
* package: re-add the "component" section
0.8.0 / 2014-03-30
==================
* add `enable()` method for nodejs. Closes #27
* change from stderr to stdout
* remove unnecessary index.js file
0.7.4 / 2013-11-13
==================
* remove "browserify" key from package.json (fixes something in browserify)
0.7.3 / 2013-10-30
==================
* fix: catch localStorage security error when cookies are blocked (Chrome)
* add debug(err) support. Closes #46
* add .browser prop to package.json. Closes #42
0.7.2 / 2013-02-06
==================
* fix package.json
* fix: Mobile Safari (private mode) is broken with debug
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
0.7.1 / 2013-02-05
==================
* add repository URL to package.json
* add DEBUG_COLORED to force colored output
* add browserify support
* fix component. Closes #24
0.7.0 / 2012-05-04
==================
* Added .component to package.json
* Added debug.component.js build
0.6.0 / 2012-03-16
==================
* Added support for "-" prefix in DEBUG [Vinay Pulim]
* Added `.enabled` flag to the node version [TooTallNate]
0.5.0 / 2012-02-02
==================
* Added: humanize diffs. Closes #8
* Added `debug.disable()` to the CS variant
* Removed padding. Closes #10
* Fixed: persist client-side variant again. Closes #9
0.4.0 / 2012-02-01
==================
* Added browser variant support for older browsers [TooTallNate]
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
* Added padding to diff (moved it to the right)
0.3.0 / 2012-01-26
==================
* Added millisecond diff when isatty, otherwise UTC string
0.2.0 / 2012-01-22
==================
* Added wildcard support
0.1.0 / 2011-12-02
==================
* Added: remove colors unless stderr isatty [TooTallNate]
0.0.1 / 2010-01-03
==================
* Initial release

View File

@ -1,33 +0,0 @@
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
# BIN directory
BIN := $(THIS_DIR)/node_modules/.bin
# applications
NODE ?= $(shell which node)
NPM ?= $(NODE) $(shell which npm)
BROWSERIFY ?= $(NODE) $(BIN)/browserify
all: dist/debug.js
install: node_modules
clean:
@rm -rf node_modules dist
dist:
@mkdir -p $@
dist/debug.js: node_modules browser.js debug.js dist
@$(BROWSERIFY) \
--standalone debug \
. > $@
node_modules: package.json
@NODE_ENV= $(NPM) install
@touch node_modules
.PHONY: all install clean

View File

@ -1,156 +0,0 @@
# debug
tiny node.js debugging utility modelled after node core's debugging technique.
## Installation
```bash
$ npm install debug
```
## Usage
With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
Example _app.js_:
```js
var debug = require('debug')('http')
, http = require('http')
, name = 'My App';
// fake app
debug('booting %s', name);
http.createServer(function(req, res){
debug(req.method + ' ' + req.url);
res.end('hello\n');
}).listen(3000, function(){
debug('listening');
});
// fake worker of some kind
require('./worker');
```
Example _worker.js_:
```js
var debug = require('debug')('worker');
setInterval(function(){
debug('doing some work');
}, 1000);
```
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
## Millisecond diff
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
## Conventions
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
## Wildcards
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
## Browser support
Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
```js
a = debug('worker:a');
b = debug('worker:b');
setInterval(function(){
a('doing some work');
}, 1000);
setInterval(function(){
b('doing some work');
}, 1200);
```
#### Web Inspector Colors
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
Colored output looks something like:
![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
### stderr vs stdout
You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
Example _stderr.js_:
```js
var debug = require('../');
var log = debug('app:log');
// by default console.log is used
log('goes to stdout!');
var error = debug('app:error');
// set this namespace to log via console.error
error.log = console.error.bind(console); // don't forget to bind to console!
error('goes to stderr');
log('still goes to stdout!');
// set all output to go via console.warn
// overrides all per-namespace log settings
debug.log = console.warn.bind(console);
log('now goes to stderr via console.warn');
error('still goes to stderr, but via console.warn now');
```
## Authors
- TJ Holowaychuk
- Nathan Rajlich
## License
(The MIT License)
Copyright (c) 2014 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
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.

View File

@ -1,147 +0,0 @@
/**
* This is the web browser implementation of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = require('./debug');
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
/**
* Colors.
*/
exports.colors = [
'lightseagreen',
'forestgreen',
'goldenrod',
'dodgerblue',
'darkorchid',
'crimson'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
function useColors() {
// is webkit? http://stackoverflow.com/a/16459606/376773
return ('WebkitAppearance' in document.documentElement.style) ||
// is firebug? http://stackoverflow.com/a/398120/376773
(window.console && (console.firebug || (console.exception && console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
}
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
exports.formatters.j = function(v) {
return JSON.stringify(v);
};
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs() {
var args = arguments;
var useColors = this.useColors;
args[0] = (useColors ? '%c' : '')
+ this.namespace
+ (useColors ? ' %c' : ' ')
+ args[0]
+ (useColors ? '%c ' : ' ')
+ '+' + exports.humanize(this.diff);
if (!useColors) return args;
var c = 'color: ' + this.color;
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
// the final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
var index = 0;
var lastC = 0;
args[0].replace(/%[a-z%]/g, function(match) {
if ('%%' === match) return;
index++;
if ('%c' === match) {
// we only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
return args;
}
/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
*
* @api public
*/
function log() {
// This hackery is required for IE8,
// where the `console.log` function doesn't have 'apply'
return 'object' == typeof console
&& 'function' == typeof console.log
&& Function.prototype.apply.call(console.log, console, arguments);
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (null == namespaces) {
localStorage.removeItem('debug');
} else {
localStorage.debug = namespaces;
}
} catch(e) {}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
var r;
try {
r = localStorage.debug;
} catch(e) {}
return r;
}
/**
* Enable namespaces listed in `localStorage.debug` initially.
*/
exports.enable(load());

View File

@ -1,19 +0,0 @@
{
"name": "debug",
"repo": "visionmedia/debug",
"description": "small debugging utility",
"version": "2.0.0",
"keywords": [
"debug",
"log",
"debugger"
],
"main": "browser.js",
"scripts": [
"browser.js",
"debug.js"
],
"dependencies": {
"guille/ms.js": "0.6.1"
}
}

View File

@ -1,197 +0,0 @@
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*
* Expose `debug()` as the module.
*/
exports = module.exports = debug;
exports.coerce = coerce;
exports.disable = disable;
exports.enable = enable;
exports.enabled = enabled;
exports.humanize = require('ms');
/**
* The currently active debug mode names, and names to skip.
*/
exports.names = [];
exports.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lowercased letter, i.e. "n".
*/
exports.formatters = {};
/**
* Previously assigned color.
*/
var prevColor = 0;
/**
* Previous log timestamp.
*/
var prevTime;
/**
* Select a color.
*
* @return {Number}
* @api private
*/
function selectColor() {
return exports.colors[prevColor++ % exports.colors.length];
}
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function debug(namespace) {
// define the `disabled` version
function disabled() {
}
disabled.enabled = false;
// define the `enabled` version
function enabled() {
var self = enabled;
// set `diff` timestamp
var curr = +new Date();
var ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
// add the `color` if not set
if (null == self.useColors) self.useColors = exports.useColors();
if (null == self.color && self.useColors) self.color = selectColor();
var args = Array.prototype.slice.call(arguments);
args[0] = exports.coerce(args[0]);
if ('string' !== typeof args[0]) {
// anything else let's inspect with %o
args = ['%o'].concat(args);
}
// apply any `formatters` transformations
var index = 0;
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
// if we encounter an escaped % then don't increase the array index
if (match === '%%') return match;
index++;
var formatter = exports.formatters[format];
if ('function' === typeof formatter) {
var val = args[index];
match = formatter.call(self, val);
// now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
if ('function' === typeof exports.formatArgs) {
args = exports.formatArgs.apply(self, args);
}
var logFn = enabled.log || exports.log || console.log.bind(console);
logFn.apply(self, args);
}
enabled.enabled = true;
var fn = exports.enabled(namespace) ? enabled : disabled;
fn.namespace = namespace;
return fn;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
exports.save(namespaces);
var split = (namespaces || '').split(/[\s,]+/);
var len = split.length;
for (var i = 0; i < len; i++) {
if (!split[i]) continue; // ignore empty strings
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
} else {
exports.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @api public
*/
function disable() {
exports.enable('');
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
var i, len;
for (i = 0, len = exports.skips.length; i < len; i++) {
if (exports.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = exports.names.length; i < len; i++) {
if (exports.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) return val.stack || val.message;
return val;
}

Some files were not shown because too many files have changed in this diff Show More