김가영

batch file update

Showing 394 changed files with 3861 additions and 0 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
@echo
cd C:\Users\rkdud\Desktop\batch_file
adb devices > C:\Users\rkdud\Desktop\batch_file\device.csv
adb shell dumpsys alarm > C:\Users\rkdud\Desktop\batch_file\alarm.csv
adb shell ps -A > C:\Users\rkdud\Desktop\batch_file\process.csv
adb shell uptime > C:\Users\rkdud\Desktop\batch_file\uptime.csv
adb shell getprop ro.product.model > C:\Users\rkdud\Desktop\batch_file\model.csv
adb shell getprop ro.build.version.release > C:\Users\rkdud\Desktop\batch_file\sdk_version.csv
adb shell getprop ro.build.version.sdk > C:\Users\rkdud\Desktop\batch_file\android_version.csv
adb install -r app-release.apk
start cmd.exe /k "node data.js"
adb shell am start -n com.example.dataextraction/com.example.dataextraction.LoadingActivity
@echo please execute the app
pause
\ No newline at end of file
No preview for this file type
const path = require('path')
const fs = require('fs')
var io = require('socket.io').listen(3000);
var exec = require('child_process').exec, child;
//var mysql = require('mysql');
//3. adb backup 명령어를 통해 데이터베이스 추출
function extractDB () {
cmd_backup = exec('adb backup com.example.dataextraction -f backup.dataextraction.ad', function(error, stdout, stderr){
console.log("backup app");
setTimeout(function(){
cmd_unpack = exec('java -jar abe.jar unpack backup.dataextraction.ad dataextraction.tar',function(error, stdout, stderr){
console.log("unpack backup");
cmd_unzip = exec('tar xvf dataextraction.tar', function(error, stdout, stderr){
console.log("unzip tar");
cmd_moveIdb = fs.rename('apps/com.example.dataextraction/db/InnerDatabase.db', 'InnerDatabase.db', function(){
console.log("move innerDB");
cmd_moveNdb = fs.rename('apps/com.example.dataextraction/db/networkDatabase.db', 'networkDatabase.db',function(){
console.log("move network db");
})
})
})
})
},7000);
});
}
//2. 애플리케이션에서 데이터베이스 생성이 끝나면 알림
io.on('connection', function(socket){
var instanceId = socket.id;
socket.on('alert', function(data){
console.log("alert");
})
socket.on('end', function(data){
console.log("extract db end");
extractDB();
})
})
\ No newline at end of file
1.3.7 / 2019-04-29
==================
* deps: negotiator@0.6.2
- Fix sorting charset, encoding, and language with extra parameters
1.3.6 / 2019-04-28
==================
* deps: mime-types@~2.1.24
- deps: mime-db@~1.40.0
1.3.5 / 2018-02-28
==================
* deps: mime-types@~2.1.18
- deps: mime-db@~1.33.0
1.3.4 / 2017-08-22
==================
* deps: mime-types@~2.1.16
- deps: mime-db@~1.29.0
1.3.3 / 2016-05-02
==================
* deps: mime-types@~2.1.11
- deps: mime-db@~1.23.0
* deps: negotiator@0.6.1
- perf: improve `Accept` parsing speed
- perf: improve `Accept-Charset` parsing speed
- perf: improve `Accept-Encoding` parsing speed
- perf: improve `Accept-Language` parsing speed
1.3.2 / 2016-03-08
==================
* deps: mime-types@~2.1.10
- Fix extension of `application/dash+xml`
- Update primary extension for `audio/mp4`
- deps: mime-db@~1.22.0
1.3.1 / 2016-01-19
==================
* deps: mime-types@~2.1.9
- deps: mime-db@~1.21.0
1.3.0 / 2015-09-29
==================
* deps: mime-types@~2.1.7
- deps: mime-db@~1.19.0
* deps: negotiator@0.6.0
- Fix including type extensions in parameters in `Accept` parsing
- Fix parsing `Accept` parameters with quoted equals
- Fix parsing `Accept` parameters with quoted semicolons
- Lazy-load modules from main entry point
- perf: delay type concatenation until needed
- perf: enable strict mode
- perf: hoist regular expressions
- perf: remove closures getting spec properties
- perf: remove a closure from media type parsing
- perf: remove property delete from media type parsing
1.2.13 / 2015-09-06
===================
* deps: mime-types@~2.1.6
- deps: mime-db@~1.18.0
1.2.12 / 2015-07-30
===================
* deps: mime-types@~2.1.4
- deps: mime-db@~1.16.0
1.2.11 / 2015-07-16
===================
* deps: mime-types@~2.1.3
- deps: mime-db@~1.15.0
1.2.10 / 2015-07-01
===================
* deps: mime-types@~2.1.2
- deps: mime-db@~1.14.0
1.2.9 / 2015-06-08
==================
* deps: mime-types@~2.1.1
- perf: fix deopt during mapping
1.2.8 / 2015-06-07
==================
* deps: mime-types@~2.1.0
- deps: mime-db@~1.13.0
* perf: avoid argument reassignment & argument slice
* perf: avoid negotiator recursive construction
* perf: enable strict mode
* perf: remove unnecessary bitwise operator
1.2.7 / 2015-05-10
==================
* deps: negotiator@0.5.3
- Fix media type parameter matching to be case-insensitive
1.2.6 / 2015-05-07
==================
* deps: mime-types@~2.0.11
- deps: mime-db@~1.9.1
* deps: negotiator@0.5.2
- Fix comparing media types with quoted values
- Fix splitting media types with quoted commas
1.2.5 / 2015-03-13
==================
* deps: mime-types@~2.0.10
- deps: mime-db@~1.8.0
1.2.4 / 2015-02-14
==================
* Support Node.js 0.6
* deps: mime-types@~2.0.9
- deps: mime-db@~1.7.0
* deps: negotiator@0.5.1
- Fix preference sorting to be stable for long acceptable lists
1.2.3 / 2015-01-31
==================
* deps: mime-types@~2.0.8
- deps: mime-db@~1.6.0
1.2.2 / 2014-12-30
==================
* deps: mime-types@~2.0.7
- deps: mime-db@~1.5.0
1.2.1 / 2014-12-30
==================
* deps: mime-types@~2.0.5
- deps: mime-db@~1.3.1
1.2.0 / 2014-12-19
==================
* deps: negotiator@0.5.0
- Fix list return order when large accepted list
- Fix missing identity encoding when q=0 exists
- Remove dynamic building of Negotiator class
1.1.4 / 2014-12-10
==================
* deps: mime-types@~2.0.4
- deps: mime-db@~1.3.0
1.1.3 / 2014-11-09
==================
* deps: mime-types@~2.0.3
- deps: mime-db@~1.2.0
1.1.2 / 2014-10-14
==================
* deps: negotiator@0.4.9
- Fix error when media type has invalid parameter
1.1.1 / 2014-09-28
==================
* deps: mime-types@~2.0.2
- deps: mime-db@~1.1.0
* deps: negotiator@0.4.8
- Fix all negotiations to be case-insensitive
- Stable sort preferences of same quality according to client order
1.1.0 / 2014-09-02
==================
* update `mime-types`
1.0.7 / 2014-07-04
==================
* Fix wrong type returned from `type` when match after unknown extension
1.0.6 / 2014-06-24
==================
* deps: negotiator@0.4.7
1.0.5 / 2014-06-20
==================
* fix crash when unknown extension given
1.0.4 / 2014-06-19
==================
* use `mime-types`
1.0.3 / 2014-06-11
==================
* deps: negotiator@0.4.6
- Order by specificity when quality is the same
1.0.2 / 2014-05-29
==================
* Fix interpretation when header not in request
* deps: pin negotiator@0.4.5
1.0.1 / 2014-01-18
==================
* Identity encoding isn't always acceptable
* deps: negotiator@~0.4.0
1.0.0 / 2013-12-27
==================
* Genesis
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.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.
# accepts
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
In addition to negotiator, it allows:
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
as well as `('text/html', 'application/json')`.
- Allows type shorthands such as `json`.
- Returns `false` when no types match
- Treats non-existent headers as `*`
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install accepts
```
## API
<!-- eslint-disable no-unused-vars -->
```js
var accepts = require('accepts')
```
### accepts(req)
Create a new `Accepts` object for the given `req`.
#### .charset(charsets)
Return the first accepted charset. If nothing in `charsets` is accepted,
then `false` is returned.
#### .charsets()
Return the charsets that the request accepts, in the order of the client's
preference (most preferred first).
#### .encoding(encodings)
Return the first accepted encoding. If nothing in `encodings` is accepted,
then `false` is returned.
#### .encodings()
Return the encodings that the request accepts, in the order of the client's
preference (most preferred first).
#### .language(languages)
Return the first accepted language. If nothing in `languages` is accepted,
then `false` is returned.
#### .languages()
Return the languages that the request accepts, in the order of the client's
preference (most preferred first).
#### .type(types)
Return the first accepted type (and it is returned as the same text as what
appears in the `types` array). If nothing in `types` is accepted, then `false`
is returned.
The `types` array can contain full MIME types or file extensions. Any value
that is not a full MIME types is passed to `require('mime-types').lookup`.
#### .types()
Return the types that the request accepts, in the order of the client's
preference (most preferred first).
## Examples
### Simple type negotiation
This simple example shows how to use `accepts` to return a different typed
respond body based on what the client wants to accept. The server lists it's
preferences in order and will get back the best match between the client and
server.
```js
var accepts = require('accepts')
var http = require('http')
function app (req, res) {
var accept = accepts(req)
// the order of this list is significant; should be server preferred order
switch (accept.type(['json', 'html'])) {
case 'json':
res.setHeader('Content-Type', 'application/json')
res.write('{"hello":"world!"}')
break
case 'html':
res.setHeader('Content-Type', 'text/html')
res.write('<b>hello, world!</b>')
break
default:
// the fallback is text/plain, so no need to specify it above
res.setHeader('Content-Type', 'text/plain')
res.write('hello, world!')
break
}
res.end()
}
http.createServer(app).listen(3000)
```
You can test this out with the cURL program:
```sh
curl -I -H'Accept: text/html' http://localhost:3000/
```
## License
[MIT](LICENSE)
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
[node-version-image]: https://badgen.net/npm/node/accepts
[node-version-url]: https://nodejs.org/en/download
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
[npm-url]: https://npmjs.org/package/accepts
[npm-version-image]: https://badgen.net/npm/v/accepts
[travis-image]: https://badgen.net/travis/jshttp/accepts/master
[travis-url]: https://travis-ci.org/jshttp/accepts
/*!
* accepts
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict'
/**
* Module dependencies.
* @private
*/
var Negotiator = require('negotiator')
var mime = require('mime-types')
/**
* Module exports.
* @public
*/
module.exports = Accepts
/**
* Create a new Accepts object for the given req.
*
* @param {object} req
* @public
*/
function Accepts (req) {
if (!(this instanceof Accepts)) {
return new Accepts(req)
}
this.headers = req.headers
this.negotiator = new Negotiator(req)
}
/**
* Check if the given `type(s)` is acceptable, returning
* the best match when true, otherwise `undefined`, in which
* case you should respond with 406 "Not Acceptable".
*
* The `type` value may be a single mime type string
* such as "application/json", the extension name
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
* or array is given the _best_ match, if any is returned.
*
* Examples:
*
* // Accept: text/html
* this.types('html');
* // => "html"
*
* // Accept: text/*, application/json
* this.types('html');
* // => "html"
* this.types('text/html');
* // => "text/html"
* this.types('json', 'text');
* // => "json"
* this.types('application/json');
* // => "application/json"
*
* // Accept: text/*, application/json
* this.types('image/png');
* this.types('png');
* // => undefined
*
* // Accept: text/*;q=.5, application/json
* this.types(['html', 'json']);
* this.types('html', 'json');
* // => "json"
*
* @param {String|Array} types...
* @return {String|Array|Boolean}
* @public
*/
Accepts.prototype.type =
Accepts.prototype.types = function (types_) {
var types = types_
// support flattened arguments
if (types && !Array.isArray(types)) {
types = new Array(arguments.length)
for (var i = 0; i < types.length; i++) {
types[i] = arguments[i]
}
}
// no types, return all requested types
if (!types || types.length === 0) {
return this.negotiator.mediaTypes()
}
// no accept header, return first given type
if (!this.headers.accept) {
return types[0]
}
var mimes = types.map(extToMime)
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
var first = accepts[0]
return first
? types[mimes.indexOf(first)]
: false
}
/**
* Return accepted encodings or best fit based on `encodings`.
*
* Given `Accept-Encoding: gzip, deflate`
* an array sorted by quality is returned:
*
* ['gzip', 'deflate']
*
* @param {String|Array} encodings...
* @return {String|Array}
* @public
*/
Accepts.prototype.encoding =
Accepts.prototype.encodings = function (encodings_) {
var encodings = encodings_
// support flattened arguments
if (encodings && !Array.isArray(encodings)) {
encodings = new Array(arguments.length)
for (var i = 0; i < encodings.length; i++) {
encodings[i] = arguments[i]
}
}
// no encodings, return all requested encodings
if (!encodings || encodings.length === 0) {
return this.negotiator.encodings()
}
return this.negotiator.encodings(encodings)[0] || false
}
/**
* Return accepted charsets or best fit based on `charsets`.
*
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
* an array sorted by quality is returned:
*
* ['utf-8', 'utf-7', 'iso-8859-1']
*
* @param {String|Array} charsets...
* @return {String|Array}
* @public
*/
Accepts.prototype.charset =
Accepts.prototype.charsets = function (charsets_) {
var charsets = charsets_
// support flattened arguments
if (charsets && !Array.isArray(charsets)) {
charsets = new Array(arguments.length)
for (var i = 0; i < charsets.length; i++) {
charsets[i] = arguments[i]
}
}
// no charsets, return all requested charsets
if (!charsets || charsets.length === 0) {
return this.negotiator.charsets()
}
return this.negotiator.charsets(charsets)[0] || false
}
/**
* Return accepted languages or best fit based on `langs`.
*
* Given `Accept-Language: en;q=0.8, es, pt`
* an array sorted by quality is returned:
*
* ['es', 'pt', 'en']
*
* @param {String|Array} langs...
* @return {Array|String}
* @public
*/
Accepts.prototype.lang =
Accepts.prototype.langs =
Accepts.prototype.language =
Accepts.prototype.languages = function (languages_) {
var languages = languages_
// support flattened arguments
if (languages && !Array.isArray(languages)) {
languages = new Array(arguments.length)
for (var i = 0; i < languages.length; i++) {
languages[i] = arguments[i]
}
}
// no languages, return all requested languages
if (!languages || languages.length === 0) {
return this.negotiator.languages()
}
return this.negotiator.languages(languages)[0] || false
}
/**
* Convert extnames to mime.
*
* @param {String} type
* @return {String}
* @private
*/
function extToMime (type) {
return type.indexOf('/') === -1
? mime.lookup(type)
: type
}
/**
* Check if mime is valid.
*
* @param {String} type
* @return {String}
* @private
*/
function validMime (type) {
return typeof type === 'string'
}
{
"_from": "accepts@~1.3.4",
"_id": "accepts@1.3.7",
"_inBundle": false,
"_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"_location": "/accepts",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "accepts@~1.3.4",
"name": "accepts",
"escapedName": "accepts",
"rawSpec": "~1.3.4",
"saveSpec": null,
"fetchSpec": "~1.3.4"
},
"_requiredBy": [
"/engine.io"
],
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
"_spec": "accepts@~1.3.4",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io",
"bugs": {
"url": "https://github.com/jshttp/accepts/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
},
{
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
}
],
"dependencies": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
},
"deprecated": false,
"description": "Higher-level content negotiation",
"devDependencies": {
"deep-equal": "1.0.1",
"eslint": "5.16.0",
"eslint-config-standard": "12.0.0",
"eslint-plugin-import": "2.17.2",
"eslint-plugin-markdown": "1.0.0",
"eslint-plugin-node": "8.0.1",
"eslint-plugin-promise": "4.1.1",
"eslint-plugin-standard": "4.0.0",
"mocha": "6.1.4",
"nyc": "14.0.0"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"LICENSE",
"HISTORY.md",
"index.js"
],
"homepage": "https://github.com/jshttp/accepts#readme",
"keywords": [
"content",
"negotiation",
"accept",
"accepts"
],
"license": "MIT",
"name": "accepts",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/accepts.git"
},
"scripts": {
"lint": "eslint --plugin markdown --ext js,md .",
"test": "mocha --reporter spec --check-leaks --bail test/",
"test-cov": "nyc --reporter=html --reporter=text npm test",
"test-travis": "nyc --reporter=text npm test"
},
"version": "1.3.7"
}
language: node_js
node_js:
- 0.6
- 0.8
- 0.9
- 0.10
- 0.12
- 4.2.4
- 5.4.1
- iojs-1
- iojs-2
- iojs-3
Copyright (c) 2011 Raynos.
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.
\ No newline at end of file
# After [![Build Status][1]][2]
Invoke callback after n calls
## Status: production ready
## Example
```js
var after = require("after")
var db = require("./db") // some db.
var updateUser = function (req, res) {
// use after to run two tasks in parallel,
// namely get request body and get session
// then run updateUser with the results
var next = after(2, updateUser)
var results = {}
getJSONBody(req, res, function (err, body) {
if (err) return next(err)
results.body = body
next(null, results)
})
getSessionUser(req, res, function (err, user) {
if (err) return next(err)
results.user = user
next(null, results)
})
// now do the thing!
function updateUser(err, result) {
if (err) {
res.statusCode = 500
return res.end("Unexpected Error")
}
if (!result.user || result.user.role !== "admin") {
res.statusCode = 403
return res.end("Permission Denied")
}
db.put("users:" + req.params.userId, result.body, function (err) {
if (err) {
res.statusCode = 500
return res.end("Unexpected Error")
}
res.statusCode = 200
res.end("Ok")
})
}
}
```
## Naive Example
```js
var after = require("after")
, next = after(3, logItWorks)
next()
next()
next() // it works
function logItWorks() {
console.log("it works!")
}
```
## Example with error handling
```js
var after = require("after")
, next = after(3, logError)
next()
next(new Error("oops")) // logs oops
next() // does nothing
// This callback is only called once.
// If there is an error the callback gets called immediately
// this avoids the situation where errors get lost.
function logError(err) {
console.log(err)
}
```
## Installation
`npm install after`
## Tests
`npm test`
## Contributors
- Raynos
- defunctzombie
## MIT Licenced
[1]: https://secure.travis-ci.org/Raynos/after.png
[2]: http://travis-ci.org/Raynos/after
[3]: http://raynos.org/blog/2/Flow-control-in-node.js
[4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307
[5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031
[6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419
[7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091
[8]: http://github.com/Raynos/iterators
[9]: http://github.com/Raynos/composite
module.exports = after
function after(count, callback, err_cb) {
var bail = false
err_cb = err_cb || noop
proxy.count = count
return (count === 0) ? callback() : proxy
function proxy(err, result) {
if (proxy.count <= 0) {
throw new Error('after called too many times')
}
--proxy.count
// after first error, rest are passed to err_cb
if (err) {
bail = true
callback(err)
// future error callbacks will go to error handler
callback = err_cb
} else if (proxy.count === 0 && !bail) {
callback(null, result)
}
}
}
function noop() {}
{
"_from": "after@0.8.2",
"_id": "after@0.8.2",
"_inBundle": false,
"_integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=",
"_location": "/after",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "after@0.8.2",
"name": "after",
"escapedName": "after",
"rawSpec": "0.8.2",
"saveSpec": null,
"fetchSpec": "0.8.2"
},
"_requiredBy": [
"/engine.io-parser"
],
"_resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz",
"_shasum": "fedb394f9f0e02aa9768e702bda23b505fae7e1f",
"_spec": "after@0.8.2",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io-parser",
"author": {
"name": "Raynos",
"email": "raynos2@gmail.com"
},
"bugs": {
"url": "https://github.com/Raynos/after/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Raynos",
"email": "raynos2@gmail.com",
"url": "http://raynos.org"
}
],
"deprecated": false,
"description": "after - tiny flow control",
"devDependencies": {
"mocha": "~1.8.1"
},
"homepage": "https://github.com/Raynos/after#readme",
"keywords": [
"flowcontrol",
"after",
"flow",
"control",
"arch"
],
"license": "MIT",
"name": "after",
"repository": {
"type": "git",
"url": "git://github.com/Raynos/after.git"
},
"scripts": {
"test": "mocha --ui tdd --reporter spec test/*.js"
},
"version": "0.8.2"
}
/*global suite, test*/
var assert = require("assert")
, after = require("../")
test("exists", function () {
assert(typeof after === "function", "after is not a function")
})
test("after when called with 0 invokes", function (done) {
after(0, done)
});
test("after 1", function (done) {
var next = after(1, done)
next()
})
test("after 5", function (done) {
var next = after(5, done)
, i = 5
while (i--) {
next()
}
})
test("manipulate count", function (done) {
var next = after(1, done)
, i = 5
next.count = i
while (i--) {
next()
}
})
test("after terminates on error", function (done) {
var next = after(2, function(err) {
assert.equal(err.message, 'test');
done();
})
next(new Error('test'))
next(new Error('test2'))
})
test('gee', function(done) {
done = after(2, done)
function cb(err) {
assert.equal(err.message, 1);
done()
}
var next = after(3, cb, function(err) {
assert.equal(err.message, 2)
done()
});
next()
next(new Error(1))
next(new Error(2))
})
test('eee', function(done) {
done = after(3, done)
function cb(err) {
assert.equal(err.message, 1);
done()
}
var next = after(3, cb, function(err) {
assert.equal(err.message, 2)
done()
});
next(new Error(1))
next(new Error(2))
next(new Error(2))
})
test('gge', function(done) {
function cb(err) {
assert.equal(err.message, 1);
done()
}
var next = after(3, cb, function(err) {
// should not happen
assert.ok(false);
});
next()
next()
next(new Error(1))
})
test('egg', function(done) {
function cb(err) {
assert.equal(err.message, 1);
done()
}
var next = after(3, cb, function(err) {
// should not happen
assert.ok(false);
});
next(new Error(1))
next()
next()
})
test('throws on too many calls', function(done) {
var next = after(1, done);
next()
assert.throws(next, /after called too many times/);
});
lib-cov
lcov.info
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
build
.grunt
node_modules
Copyright (C) 2013 Rase-
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.
REPORTER = dot
test:
@./node_modules/.bin/mocha \
--reporter $(REPORTER)
.PHONY: test
# How to
```javascript
var sliceBuffer = require('arraybuffer.slice');
var ab = (new Int8Array(5)).buffer;
var sliced = sliceBuffer(ab, 1, 3);
sliced = sliceBuffer(ab, 1);
```
# Licence (MIT)
Copyright (C) 2013 Rase-
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.
/**
* An abstraction for slicing an arraybuffer even when
* ArrayBuffer.prototype.slice is not supported
*
* @api public
*/
module.exports = function(arraybuffer, start, end) {
var bytes = arraybuffer.byteLength;
start = start || 0;
end = end || bytes;
if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
if (start < 0) { start += bytes; }
if (end < 0) { end += bytes; }
if (end > bytes) { end = bytes; }
if (start >= bytes || start >= end || bytes === 0) {
return new ArrayBuffer(0);
}
var abv = new Uint8Array(arraybuffer);
var result = new Uint8Array(end - start);
for (var i = start, ii = 0; i < end; i++, ii++) {
result[ii] = abv[i];
}
return result.buffer;
};
{
"_from": "arraybuffer.slice@~0.0.7",
"_id": "arraybuffer.slice@0.0.7",
"_inBundle": false,
"_integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==",
"_location": "/arraybuffer.slice",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "arraybuffer.slice@~0.0.7",
"name": "arraybuffer.slice",
"escapedName": "arraybuffer.slice",
"rawSpec": "~0.0.7",
"saveSpec": null,
"fetchSpec": "~0.0.7"
},
"_requiredBy": [
"/engine.io-parser"
],
"_resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz",
"_shasum": "3bbc4275dd584cc1b10809b89d4e8b63a69e7675",
"_spec": "arraybuffer.slice@~0.0.7",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io-parser",
"bugs": {
"url": "https://github.com/rase-/arraybuffer.slice/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Exports a function for slicing ArrayBuffers (no polyfilling)",
"devDependencies": {
"expect.js": "0.2.0",
"mocha": "1.17.1"
},
"homepage": "https://github.com/rase-/arraybuffer.slice",
"license": "MIT",
"name": "arraybuffer.slice",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/rase-/arraybuffer.slice.git"
},
"version": "0.0.7"
}
/*
* Test dependencies
*/
var sliceBuffer = require('../index.js');
var expect = require('expect.js');
/**
* Tests
*/
describe('sliceBuffer', function() {
describe('using standard slice', function() {
it('should slice correctly with only start provided', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, 3);
var sabv = new Uint8Array(sliced);
for (var i = 3, ii = 0; i < abv.length; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with start and end provided', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, 3, 8);
var sabv = new Uint8Array(sliced);
for (var i = 3, ii = 0; i < 8; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with negative start', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, -3);
var sabv = new Uint8Array(sliced);
for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with negative end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, 0, -3);
var sabv = new Uint8Array(sliced);
for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with negative start and end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, -6, -3);
var sabv = new Uint8Array(sliced);
for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with equal start and end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, 1, 1);
expect(sliced.byteLength).to.equal(0);
});
it('should slice correctly when end larger than buffer', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, 0, 100);
expect(new Uint8Array(sliced)).to.eql(abv);
});
it('shoud slice correctly when start larger than end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var sliced = sliceBuffer(abv.buffer, 6, 5);
expect(sliced.byteLength).to.equal(0);
});
});
describe('using fallback', function() {
it('should slice correctly with only start provided', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, 3);
var sabv = new Uint8Array(sliced);
for (var i = 3, ii = 0; i < abv.length; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with start and end provided', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, 3, 8);
var sabv = new Uint8Array(sliced);
for (var i = 3, ii = 0; i < 8; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with negative start', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, -3);
var sabv = new Uint8Array(sliced);
for (var i = abv.length - 3, ii = 0; i < abv.length; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with negative end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, 0, -3);
var sabv = new Uint8Array(sliced);
for (var i = 0, ii = 0; i < abv.length - 3; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with negative start and end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, -6, -3);
var sabv = new Uint8Array(sliced);
for (var i = abv.length - 6, ii = 0; i < abv.length - 3; i++, ii++) {
expect(abv[i]).to.equal(sabv[ii]);
}
});
it('should slice correctly with equal start and end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, 1, 1);
expect(sliced.byteLength).to.equal(0);
});
it('should slice correctly when end larger than buffer', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, 0, 100);
var sabv = new Uint8Array(sliced);
for (var i = 0; i < abv.length; i++) {
expect(abv[i]).to.equal(sabv[i]);
}
});
it('shoud slice correctly when start larger than end', function() {
var abv = new Uint8Array(10);
for (var i = 0; i < abv.length; i++) {
abv[i] = i;
}
var ab = abv.buffer;
ab.slice = undefined;
var sliced = sliceBuffer(ab, 6, 5);
expect(sliced.byteLength).to.equal(0);
});
});
});
coverage
.nyc_output
\ No newline at end of file
{
"check-coverage": false,
"lines": 99,
"statements": 99,
"functions": 99,
"branches": 99,
"include": [
"index.js"
]
}
\ No newline at end of file
language: node_js
node_js:
- "6"
- "8"
- "10"
- "node"
script: npm run travis
cache:
yarn: true
The MIT License (MIT)
Copyright (c) 2017 Samuel Reed <samuel.trace.reed@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.
'use strict';
function Queue(options) {
if (!(this instanceof Queue)) {
return new Queue(options);
}
options = options || {};
this.concurrency = options.concurrency || Infinity;
this.pending = 0;
this.jobs = [];
this.cbs = [];
this._done = done.bind(this);
}
var arrayAddMethods = [
'push',
'unshift',
'splice'
];
arrayAddMethods.forEach(function(method) {
Queue.prototype[method] = function() {
var methodResult = Array.prototype[method].apply(this.jobs, arguments);
this._run();
return methodResult;
};
});
Object.defineProperty(Queue.prototype, 'length', {
get: function() {
return this.pending + this.jobs.length;
}
});
Queue.prototype._run = function() {
if (this.pending === this.concurrency) {
return;
}
if (this.jobs.length) {
var job = this.jobs.shift();
this.pending++;
job(this._done);
this._run();
}
if (this.pending === 0) {
while (this.cbs.length !== 0) {
var cb = this.cbs.pop();
process.nextTick(cb);
}
}
};
Queue.prototype.onDone = function(cb) {
if (typeof cb === 'function') {
this.cbs.push(cb);
this._run();
}
};
function done() {
this.pending--;
this._run();
}
module.exports = Queue;
{
"_from": "async-limiter@~1.0.0",
"_id": "async-limiter@1.0.1",
"_inBundle": false,
"_integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
"_location": "/async-limiter",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "async-limiter@~1.0.0",
"name": "async-limiter",
"escapedName": "async-limiter",
"rawSpec": "~1.0.0",
"saveSpec": null,
"fetchSpec": "~1.0.0"
},
"_requiredBy": [
"/engine.io-client/ws"
],
"_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
"_shasum": "dd379e94f0db8310b08291f9d64c3209766617fd",
"_spec": "async-limiter@~1.0.0",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io-client\\node_modules\\ws",
"author": {
"name": "Samuel Reed"
},
"bugs": {
"url": "https://github.com/strml/async-limiter/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "asynchronous function queue with adjustable concurrency",
"devDependencies": {
"coveralls": "^3.0.3",
"eslint": "^5.16.0",
"eslint-plugin-mocha": "^5.3.0",
"intelli-espower-loader": "^1.0.1",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"power-assert": "^1.6.1"
},
"homepage": "https://github.com/strml/async-limiter#readme",
"keywords": [
"throttle",
"async",
"limiter",
"asynchronous",
"job",
"task",
"concurrency",
"concurrent"
],
"license": "MIT",
"name": "async-limiter",
"repository": {
"type": "git",
"url": "git+https://github.com/strml/async-limiter.git"
},
"scripts": {
"coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"example": "node example",
"lint": "eslint .",
"test": "mocha --require intelli-espower-loader test/",
"travis": "npm run lint && npm run test"
},
"version": "1.0.1"
}
# Async-Limiter
A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue).
[![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter)
[![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter)
[![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter)
This module exports a class `Limiter` that implements some of the `Array` API.
Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods.
## Motivation
Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when
run at infinite concurrency.
In this case, it is actually faster, and takes far less memory, to limit concurrency.
This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would
make this module faster or lighter, but new functionality is not desired.
Style should confirm to nodejs/node style.
## Example
``` javascript
var Limiter = require('async-limiter')
var t = new Limiter({concurrency: 2});
var results = []
// add jobs using the familiar Array API
t.push(function (cb) {
results.push('two')
cb()
})
t.push(
function (cb) {
results.push('four')
cb()
},
function (cb) {
results.push('five')
cb()
}
)
t.unshift(function (cb) {
results.push('one')
cb()
})
t.splice(2, 0, function (cb) {
results.push('three')
cb()
})
// Jobs run automatically. If you want a callback when all are done,
// call 'onDone()'.
t.onDone(function () {
console.log('all done:', results)
})
```
## Zlib Example
```js
const zlib = require('zlib');
const Limiter = require('async-limiter');
const message = {some: "data"};
const payload = new Buffer(JSON.stringify(message));
// Try with different concurrency values to see how this actually
// slows significantly with higher concurrency!
//
// 5: 1398.607ms
// 10: 1375.668ms
// Infinity: 4423.300ms
//
const t = new Limiter({concurrency: 5});
function deflate(payload, cb) {
t.push(function(done) {
zlib.deflate(payload, function(err, buffer) {
done();
cb(err, buffer);
});
});
}
console.time('deflate');
for(let i = 0; i < 30000; ++i) {
deflate(payload, function (err, buffer) {});
}
t.onDone(function() {
console.timeEnd('deflate');
});
```
## Install
`npm install async-limiter`
## Test
`npm test`
## API
### `var t = new Limiter([opts])`
Constructor. `opts` may contain inital values for:
* `t.concurrency`
## Instance methods
### `t.onDone(fn)`
`fn` will be called once and only once, when the queue is empty.
## Instance methods mixed in from `Array`
Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).
### `t.push(element1, ..., elementN)`
### `t.unshift(element1, ..., elementN)`
### `t.splice(index , howMany[, element1[, ...[, elementN]]])`
## Properties
### `t.concurrency`
Max number of jobs the queue should process concurrently, defaults to `Infinity`.
### `t.length`
Jobs pending + jobs to process (readonly).
1.0.1 / 2014-02-17
==================
* go away decimal point
* history
1.0.0 / 2014-02-17
==================
* add jitter option
* Initial commit
test:
@./node_modules/.bin/mocha \
--require should \
--reporter dot \
--bail
.PHONY: test
\ No newline at end of file
# backo
Simple exponential backoff because the others seem to have weird abstractions.
## Installation
```
$ npm install backo
```
## Options
- `min` initial timeout in milliseconds [100]
- `max` max timeout [10000]
- `jitter` [0]
- `factor` [2]
## Example
```js
var Backoff = require('backo');
var backoff = new Backoff({ min: 100, max: 20000 });
setTimeout(function(){
something.reconnect();
}, backoff.duration());
// later when something works
backoff.reset()
```
# License
MIT
{
"name": "backo",
"repo": "segmentio/backo",
"dependencies": {},
"version": "1.0.1",
"description": "simple backoff without the weird abstractions",
"keywords": ["backoff"],
"license": "MIT",
"scripts": ["index.js"],
"main": "index.js"
}
/**
* Expose `Backoff`.
*/
module.exports = Backoff;
/**
* Initialize backoff timer with `opts`.
*
* - `min` initial timeout in milliseconds [100]
* - `max` max timeout [10000]
* - `jitter` [0]
* - `factor` [2]
*
* @param {Object} opts
* @api public
*/
function Backoff(opts) {
opts = opts || {};
this.ms = opts.min || 100;
this.max = opts.max || 10000;
this.factor = opts.factor || 2;
this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
this.attempts = 0;
}
/**
* Return the backoff duration.
*
* @return {Number}
* @api public
*/
Backoff.prototype.duration = function(){
var ms = this.ms * Math.pow(this.factor, this.attempts++);
if (this.jitter) {
var rand = Math.random();
var deviation = Math.floor(rand * this.jitter * ms);
ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
}
return Math.min(ms, this.max) | 0;
};
/**
* Reset the number of attempts.
*
* @api public
*/
Backoff.prototype.reset = function(){
this.attempts = 0;
};
/**
* Set the minimum duration
*
* @api public
*/
Backoff.prototype.setMin = function(min){
this.ms = min;
};
/**
* Set the maximum duration
*
* @api public
*/
Backoff.prototype.setMax = function(max){
this.max = max;
};
/**
* Set the jitter
*
* @api public
*/
Backoff.prototype.setJitter = function(jitter){
this.jitter = jitter;
};
{
"_from": "backo2@1.0.2",
"_id": "backo2@1.0.2",
"_inBundle": false,
"_integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=",
"_location": "/backo2",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "backo2@1.0.2",
"name": "backo2",
"escapedName": "backo2",
"rawSpec": "1.0.2",
"saveSpec": null,
"fetchSpec": "1.0.2"
},
"_requiredBy": [
"/socket.io-client"
],
"_resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
"_shasum": "31ab1ac8b129363463e35b3ebb69f4dfcfba7947",
"_spec": "backo2@1.0.2",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\socket.io-client",
"bugs": {
"url": "https://github.com/mokesmokes/backo/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "simple backoff based on segmentio/backo",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"homepage": "https://github.com/mokesmokes/backo#readme",
"keywords": [
"backoff"
],
"license": "MIT",
"name": "backo2",
"repository": {
"type": "git",
"url": "git+https://github.com/mokesmokes/backo.git"
},
"version": "1.0.2"
}
var Backoff = require('..');
var assert = require('assert');
describe('.duration()', function(){
it('should increase the backoff', function(){
var b = new Backoff;
assert(100 == b.duration());
assert(200 == b.duration());
assert(400 == b.duration());
assert(800 == b.duration());
b.reset();
assert(100 == b.duration());
assert(200 == b.duration());
})
})
\ No newline at end of file
language: node_js
node_js:
- '0.12'
- iojs-1
- iojs-2
- iojs-3
- '4.1'
before_script:
- npm install
before_install: npm install -g npm@'>=2.13.5'
deploy:
provider: npm
email: niklasvh@gmail.com
api_key:
secure: oHV9ArprTj5WOk7MP1UF7QMJ70huXw+y7xXb5wF4+V2H8Hyfa5TfE0DiOmqrube1WXTeH1FLgq54shp/sJWi47Hkg/GyeoB5NnsPhYEaJkaON9UG5blML+ODiNVsEnq/1kNBQ8e0+0JItMPLGySKyFmuZ3yflulXKS8O88mfINo=
on:
tags: true
branch: master
repo: niklasvh/base64-arraybuffer
Copyright (c) 2012 Niklas von Hertzen
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.
# base64-arraybuffer
[![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer)
[![NPM Downloads](https://img.shields.io/npm/dm/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer)
[![NPM Version](https://img.shields.io/npm/v/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer)
Encode/decode base64 data into ArrayBuffers
## Getting Started
Install the module with: `npm install base64-arraybuffer`
## API
The library encodes and decodes base64 to and from ArrayBuffers
- __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string
- __decode(str)__ - Decodes base64 string to `ArrayBuffer`
## License
Copyright (c) 2012 Niklas von Hertzen
Licensed under the MIT license.
/*
* base64-arraybuffer
* https://github.com/niklasvh/base64-arraybuffer
*
* Copyright (c) 2012 Niklas von Hertzen
* Licensed under the MIT license.
*/
(function(chars){
"use strict";
exports.encode = function(arraybuffer) {
var bytes = new Uint8Array(arraybuffer),
i, len = bytes.length, base64 = "";
for (i = 0; i < len; i+=3) {
base64 += chars[bytes[i] >> 2];
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
base64 += chars[bytes[i + 2] & 63];
}
if ((len % 3) === 2) {
base64 = base64.substring(0, base64.length - 1) + "=";
} else if (len % 3 === 1) {
base64 = base64.substring(0, base64.length - 2) + "==";
}
return base64;
};
exports.decode = function(base64) {
var bufferLength = base64.length * 0.75,
len = base64.length, i, p = 0,
encoded1, encoded2, encoded3, encoded4;
if (base64[base64.length - 1] === "=") {
bufferLength--;
if (base64[base64.length - 2] === "=") {
bufferLength--;
}
}
var arraybuffer = new ArrayBuffer(bufferLength),
bytes = new Uint8Array(arraybuffer);
for (i = 0; i < len; i+=4) {
encoded1 = chars.indexOf(base64[i]);
encoded2 = chars.indexOf(base64[i+1]);
encoded3 = chars.indexOf(base64[i+2]);
encoded4 = chars.indexOf(base64[i+3]);
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
}
return arraybuffer;
};
})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
{
"_from": "base64-arraybuffer@0.1.4",
"_id": "base64-arraybuffer@0.1.4",
"_inBundle": false,
"_integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=",
"_location": "/base64-arraybuffer",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "base64-arraybuffer@0.1.4",
"name": "base64-arraybuffer",
"escapedName": "base64-arraybuffer",
"rawSpec": "0.1.4",
"saveSpec": null,
"fetchSpec": "0.1.4"
},
"_requiredBy": [
"/engine.io-parser"
],
"_resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz",
"_shasum": "9818c79e059b1355f97e0428a017c838e90ba812",
"_spec": "base64-arraybuffer@0.1.4",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io-parser",
"author": {
"name": "Niklas von Hertzen",
"email": "niklasvh@gmail.com",
"url": "http://hertzen.com"
},
"bugs": {
"url": "https://github.com/niklasvh/base64-arraybuffer/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Encode/decode base64 data into ArrayBuffers",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-nodeunit": "^0.4.1",
"grunt-contrib-watch": "^0.6.1"
},
"engines": {
"node": ">= 0.6.0"
},
"homepage": "https://github.com/niklasvh/base64-arraybuffer",
"keywords": [],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT"
}
],
"main": "lib/base64-arraybuffer",
"name": "base64-arraybuffer",
"repository": {
"type": "git",
"url": "git+https://github.com/niklasvh/base64-arraybuffer.git"
},
"scripts": {
"test": "grunt nodeunit"
},
"version": "0.1.4"
}
# [2.0.0](https://github.com/faeldt/base64id/compare/1.0.0...2.0.0) (2019-05-27)
### Code Refactoring
* **buffer:** replace deprecated Buffer constructor usage ([#11](https://github.com/faeldt/base64id/issues/11)) ([ccfba54](https://github.com/faeldt/base64id/commit/ccfba54))
### BREAKING CHANGES
* **buffer:** drop support for Node.js ≤ 4.4.x and 5.0.0 - 5.9.x
See: https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/
(The MIT License)
Copyright (c) 2012-2016 Kristian Faeldt <faeldt_kristian@cyberagent.co.jp>
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.
base64id
========
Node.js module that generates a base64 id.
Uses crypto.randomBytes when available, falls back to unsafe methods for node.js <= 0.4.
To increase performance, random bytes are buffered to minimize the number of synchronous calls to crypto.randomBytes.
## Installation
$ npm install base64id
## Usage
var base64id = require('base64id');
var id = base64id.generateId();
/*!
* base64id v0.1.0
*/
/**
* Module dependencies
*/
var crypto = require('crypto');
/**
* Constructor
*/
var Base64Id = function() { };
/**
* Get random bytes
*
* Uses a buffer if available, falls back to crypto.randomBytes
*/
Base64Id.prototype.getRandomBytes = function(bytes) {
var BUFFER_SIZE = 4096
var self = this;
bytes = bytes || 12;
if (bytes > BUFFER_SIZE) {
return crypto.randomBytes(bytes);
}
var bytesInBuffer = parseInt(BUFFER_SIZE/bytes);
var threshold = parseInt(bytesInBuffer*0.85);
if (!threshold) {
return crypto.randomBytes(bytes);
}
if (this.bytesBufferIndex == null) {
this.bytesBufferIndex = -1;
}
if (this.bytesBufferIndex == bytesInBuffer) {
this.bytesBuffer = null;
this.bytesBufferIndex = -1;
}
// No buffered bytes available or index above threshold
if (this.bytesBufferIndex == -1 || this.bytesBufferIndex > threshold) {
if (!this.isGeneratingBytes) {
this.isGeneratingBytes = true;
crypto.randomBytes(BUFFER_SIZE, function(err, bytes) {
self.bytesBuffer = bytes;
self.bytesBufferIndex = 0;
self.isGeneratingBytes = false;
});
}
// Fall back to sync call when no buffered bytes are available
if (this.bytesBufferIndex == -1) {
return crypto.randomBytes(bytes);
}
}
var result = this.bytesBuffer.slice(bytes*this.bytesBufferIndex, bytes*(this.bytesBufferIndex+1));
this.bytesBufferIndex++;
return result;
}
/**
* Generates a base64 id
*
* (Original version from socket.io <http://socket.io>)
*/
Base64Id.prototype.generateId = function () {
var rand = Buffer.alloc(15); // multiple of 3 for base64
if (!rand.writeInt32BE) {
return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString()
+ Math.abs(Math.random() * Math.random() * Date.now() | 0).toString();
}
this.sequenceNumber = (this.sequenceNumber + 1) | 0;
rand.writeInt32BE(this.sequenceNumber, 11);
if (crypto.randomBytes) {
this.getRandomBytes(12).copy(rand);
} else {
// not secure for node 0.4
[0, 4, 8].forEach(function(i) {
rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i);
});
}
return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-');
};
/**
* Export
*/
exports = module.exports = new Base64Id();
{
"_from": "base64id@2.0.0",
"_id": "base64id@2.0.0",
"_inBundle": false,
"_integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
"_location": "/base64id",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "base64id@2.0.0",
"name": "base64id",
"escapedName": "base64id",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/engine.io"
],
"_resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"_shasum": "2770ac6bc47d312af97a8bf9a634342e0cd25cb6",
"_spec": "base64id@2.0.0",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io",
"author": {
"name": "Kristian Faeldt",
"email": "faeldt_kristian@cyberagent.co.jp"
},
"bugs": {
"url": "https://github.com/faeldt/base64id/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Generates a base64 id",
"engines": {
"node": "^4.5.0 || >= 5.9"
},
"homepage": "https://github.com/faeldt/base64id#readme",
"license": "MIT",
"main": "./lib/base64id.js",
"name": "base64id",
"repository": {
"type": "git",
"url": "git+https://github.com/faeldt/base64id.git"
},
"version": "2.0.0"
}
1.0.0 / 2013-02-03
==================
* Stop using the removed magic __stack global getter
0.1.0 / 2012-10-04
==================
* add throwing of AssertionError for test frameworks etc
0.0.1 / 2010-01-03
==================
* Initial release
test:
@echo "populate me"
.PHONY: test
\ No newline at end of file
# better-assert
Better c-style assertions using [callsite](https://github.com/visionmedia/callsite) for
self-documenting failure messages.
## Installation
$ npm install better-assert
## Example
By default assertions are enabled, however the __NO_ASSERT__ environment variable
will deactivate them when truthy.
```js
var assert = require('better-assert');
test();
function test() {
var user = { name: 'tobi' };
assert('tobi' == user.name);
assert('number' == typeof user.age);
}
AssertionError: 'number' == typeof user.age
at test (/Users/tj/projects/better-assert/example.js:9:3)
at Object.<anonymous> (/Users/tj/projects/better-assert/example.js:4:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
```
## License
(The MIT License)
Copyright (c) 2012 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.
\ No newline at end of file
var assert = require('./');
test();
function test() {
var user = { name: 'tobi' };
assert('tobi' == user.name);
assert('number' == typeof user.age);
}
\ No newline at end of file
/**
* Module dependencies.
*/
var AssertionError = require('assert').AssertionError
, callsite = require('callsite')
, fs = require('fs')
/**
* Expose `assert`.
*/
module.exports = process.env.NO_ASSERT
? function(){}
: assert;
/**
* Assert the given `expr`.
*/
function assert(expr) {
if (expr) return;
var stack = callsite();
var call = stack[1];
var file = call.getFileName();
var lineno = call.getLineNumber();
var src = fs.readFileSync(file, 'utf8');
var line = src.split('\n')[lineno-1];
var src = line.match(/assert\((.*)\)/)[1];
var err = new AssertionError({
message: src,
stackStartFunction: stack[0].getFunction()
});
throw err;
}
{
"_from": "better-assert@~1.0.0",
"_id": "better-assert@1.0.2",
"_inBundle": false,
"_integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
"_location": "/better-assert",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "better-assert@~1.0.0",
"name": "better-assert",
"escapedName": "better-assert",
"rawSpec": "~1.0.0",
"saveSpec": null,
"fetchSpec": "~1.0.0"
},
"_requiredBy": [
"/parseqs",
"/parseuri"
],
"_resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
"_shasum": "40866b9e1b9e0b55b481894311e68faffaebc522",
"_spec": "better-assert@~1.0.0",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\parseqs",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"bugs": {
"url": "https://github.com/visionmedia/better-assert/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "TonyHe",
"email": "coolhzb@163.com"
},
{
"name": "ForbesLindesay"
}
],
"dependencies": {
"callsite": "1.0.0"
},
"deprecated": false,
"description": "Better assertions for node, reporting the expr, filename, lineno etc",
"engines": {
"node": "*"
},
"homepage": "https://github.com/visionmedia/better-assert#readme",
"keywords": [
"assert",
"stack",
"trace",
"debug"
],
"main": "index",
"name": "better-assert",
"repository": {
"type": "git",
"url": "git+https://github.com/visionmedia/better-assert.git"
},
"version": "1.0.2"
}
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownProjectSettings" wasCopied="true">
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true" replaceUnicodeEmoji="false" lastLayoutSetsDefault="false">
<PanelProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
</PanelProvider>
</PreviewSettings>
<ParserSettings gitHubSyntaxChange="false" emojiShortcuts="1" emojiImages="0">
<PegdownExtensions>
<option name="ABBREVIATIONS" value="false" />
<option name="ANCHORLINKS" value="true" />
<option name="ASIDE" value="false" />
<option name="ATXHEADERSPACE" value="true" />
<option name="AUTOLINKS" value="true" />
<option name="DEFINITIONS" value="false" />
<option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
<option name="FENCED_CODE_BLOCKS" value="true" />
<option name="FOOTNOTES" value="false" />
<option name="HARDWRAPS" value="false" />
<option name="HTML_DEEP_PARSER" value="false" />
<option name="INSERTED" value="false" />
<option name="QUOTES" value="false" />
<option name="RELAXEDHRULES" value="true" />
<option name="SMARTS" value="false" />
<option name="STRIKETHROUGH" value="true" />
<option name="SUBSCRIPT" value="false" />
<option name="SUPERSCRIPT" value="false" />
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
<option name="SUPPRESS_INLINE_HTML" value="false" />
<option name="TABLES" value="true" />
<option name="TASKLISTITEMS" value="true" />
<option name="TOC" value="false" />
<option name="WIKILINKS" value="true" />
</PegdownExtensions>
<ParserOptions>
<option name="ADMONITION_EXT" value="false" />
<option name="ATTRIBUTES_EXT" value="false" />
<option name="COMMONMARK_LISTS" value="true" />
<option name="DUMMY" value="false" />
<option name="EMOJI_SHORTCUTS" value="true" />
<option name="ENUMERATED_REFERENCES_EXT" value="false" />
<option name="FLEXMARK_FRONT_MATTER" value="false" />
<option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
<option name="GFM_TABLE_RENDERING" value="true" />
<option name="GITBOOK_URL_ENCODING" value="false" />
<option name="GITHUB_LISTS" value="false" />
<option name="GITHUB_WIKI_LINKS" value="true" />
<option name="HEADER_ID_NO_DUPED_DASHES" value="false" />
<option name="JEKYLL_FRONT_MATTER" value="false" />
<option name="NO_TEXT_ATTRIBUTES" value="false" />
<option name="PARSE_HTML_ANCHOR_ID" value="false" />
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
</ParserOptions>
</ParserSettings>
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true" embedImages="false" embedHttpImages="false" imageUriSerials="false">
<GeneratorProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
</GeneratorProvider>
<headerTop />
<headerBottom />
<bodyTop />
<bodyBottom />
</HtmlSettings>
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="false" isCssTextEnabled="false" isDynamicPageWidth="true">
<StylesheetProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
</StylesheetProvider>
<ScriptProviders />
<cssText />
<cssUriHistory />
</CssSettings>
<HtmlExportSettings updateOnSave="false" parentDir="" targetDir="" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
<LinkMapSettings>
<textMaps />
</LinkMapSettings>
</component>
</project>
\ No newline at end of file
<component name="MarkdownNavigator.ProfileManager">
<settings default="" pdf-export="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/blob.iml" filepath="$PROJECT_DIR$/.idea/blob.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed. Click to expand it.
ui: mocha-bdd
browsers:
- name: chrome
version: 8..latest
- name: firefox
version: 7..latest
- name: safari
version: 6..latest
- name: opera
version: 12.1..latest
- name: ie
version: 10..latest
- name: android
version: latest
MIT License
Copyright (C) 2014 Rase-
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.
REPORTER = dot
build: blob.js
blob.js:
@./node_modules/.bin/browserify --standalone blob index.js > blob.js
test:
@./node_modules/.bin/zuul -- test/index.js
clean:
rm blob.js
.PHONY: test blob.js
# Blob
A cross-browser `Blob` that falls back to `BlobBuilder` when appropriate.
If neither is available, it exports `undefined`.
## Installation
``` bash
$ npm install blob
```
## Example
``` js
var Blob = require('blob');
var b = new Blob(['hi', 'constructing', 'a', 'blob']);
```
## License
MIT
{
"name": "blob",
"repo": "webmodules/blob",
"description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.",
"version": "0.0.4",
"license": "MIT",
"dependencies": {},
"scripts": [
"index.js"
]
}
/**
* Create a blob builder even when vendor prefixes exist
*/
var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :
typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :
typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :
typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder :
false;
/**
* Check if Blob constructor is supported
*/
var blobSupported = (function() {
try {
var a = new Blob(['hi']);
return a.size === 2;
} catch(e) {
return false;
}
})();
/**
* Check if Blob constructor supports ArrayBufferViews
* Fails in Safari 6, so we need to map to ArrayBuffers there.
*/
var blobSupportsArrayBufferView = blobSupported && (function() {
try {
var b = new Blob([new Uint8Array([1,2])]);
return b.size === 2;
} catch(e) {
return false;
}
})();
/**
* Check if BlobBuilder is supported
*/
var blobBuilderSupported = BlobBuilder
&& BlobBuilder.prototype.append
&& BlobBuilder.prototype.getBlob;
/**
* Helper function that maps ArrayBufferViews to ArrayBuffers
* Used by BlobBuilder constructor and old browsers that didn't
* support it in the Blob constructor.
*/
function mapArrayBufferViews(ary) {
return ary.map(function(chunk) {
if (chunk.buffer instanceof ArrayBuffer) {
var buf = chunk.buffer;
// if this is a subarray, make a copy so we only
// include the subarray region from the underlying buffer
if (chunk.byteLength !== buf.byteLength) {
var copy = new Uint8Array(chunk.byteLength);
copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));
buf = copy.buffer;
}
return buf;
}
return chunk;
});
}
function BlobBuilderConstructor(ary, options) {
options = options || {};
var bb = new BlobBuilder();
mapArrayBufferViews(ary).forEach(function(part) {
bb.append(part);
});
return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
};
function BlobConstructor(ary, options) {
return new Blob(mapArrayBufferViews(ary), options || {});
};
if (typeof Blob !== 'undefined') {
BlobBuilderConstructor.prototype = Blob.prototype;
BlobConstructor.prototype = Blob.prototype;
}
module.exports = (function() {
if (blobSupported) {
return blobSupportsArrayBufferView ? Blob : BlobConstructor;
} else if (blobBuilderSupported) {
return BlobBuilderConstructor;
} else {
return undefined;
}
})();
{
"_from": "blob@0.0.5",
"_id": "blob@0.0.5",
"_inBundle": false,
"_integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==",
"_location": "/blob",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "blob@0.0.5",
"name": "blob",
"escapedName": "blob",
"rawSpec": "0.0.5",
"saveSpec": null,
"fetchSpec": "0.0.5"
},
"_requiredBy": [
"/engine.io-parser"
],
"_resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",
"_shasum": "d680eeef25f8cd91ad533f5b01eed48e64caf683",
"_spec": "blob@0.0.5",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io-parser",
"bugs": {
"url": "https://github.com/webmodules/blob/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.",
"devDependencies": {
"browserify": "4.2.3",
"expect.js": "0.2.0",
"mocha": "1.17.1",
"zuul": "1.10.2"
},
"homepage": "https://github.com/webmodules/blob",
"license": "MIT",
"name": "blob",
"repository": {
"type": "git",
"url": "git://github.com/webmodules/blob.git"
},
"scripts": {
"test": "make test"
},
"version": "0.0.5"
}
var Blob = require('../');
var expect = require('expect.js');
describe('blob', function() {
if (!Blob) {
it('should not have a blob or a blob builder in the global namespace, or blob should not be a constructor function if the module exports false', function() {
try {
var ab = (new Uint8Array(5)).buffer;
global.Blob([ab]);
expect().fail('Blob shouldn\'t be constructable');
} catch (e) {}
var BlobBuilder = global.BlobBuilder
|| global.WebKitBlobBuilder
|| global.MSBlobBuilder
|| global.MozBlobBuilder;
expect(BlobBuilder).to.be(undefined);
});
} else {
it('should encode a proper sized blob when given a string argument', function() {
var b = new Blob(['hi']);
expect(b.size).to.be(2);
});
it('should encode a blob with proper size when given two strings as arguments', function() {
var b = new Blob(['hi', 'hello']);
expect(b.size).to.be(7);
});
it('should encode arraybuffers with right content', function(done) {
var ary = new Uint8Array(5);
for (var i = 0; i < 5; i++) ary[i] = i;
var b = new Blob([ary.buffer]);
var fr = new FileReader();
fr.onload = function() {
var newAry = new Uint8Array(this.result);
for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i);
done();
};
fr.readAsArrayBuffer(b);
});
it('should encode typed arrays with right content', function(done) {
var ary = new Uint8Array(5);
for (var i = 0; i < 5; i++) ary[i] = i;
var b = new Blob([ary]);
var fr = new FileReader();
fr.onload = function() {
var newAry = new Uint8Array(this.result);
for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i);
done();
};
fr.readAsArrayBuffer(b);
});
it('should encode sliced typed arrays with right content', function(done) {
var ary = new Uint8Array(5);
for (var i = 0; i < 5; i++) ary[i] = i;
var b = new Blob([ary.subarray(2)]);
var fr = new FileReader();
fr.onload = function() {
var newAry = new Uint8Array(this.result);
for (var i = 0; i < 3; i++) expect(newAry[i]).to.be(i + 2);
done();
};
fr.readAsArrayBuffer(b);
});
it('should encode with blobs', function(done) {
var ary = new Uint8Array(5);
for (var i = 0; i < 5; i++) ary[i] = i;
var b = new Blob([new Blob([ary.buffer])]);
var fr = new FileReader();
fr.onload = function() {
var newAry = new Uint8Array(this.result);
for (var i = 0; i < 5; i++) expect(newAry[i]).to.be(i);
done();
};
fr.readAsArrayBuffer(b);
});
it('should enode mixed contents to right size', function() {
var ary = new Uint8Array(5);
for (var i = 0; i < 5; i++) ary[i] = i;
var b = new Blob([ary.buffer, 'hello']);
expect(b.size).to.be(10);
});
it('should accept mime type', function() {
var b = new Blob(['hi', 'hello'], { type: 'text/html' });
expect(b.type).to.be('text/html');
});
it('should be an instance of constructor', function() {
var b = new Blob(['hi']);
expect(b).to.be.a(Blob);
expect(b).to.be.a(global.Blob);
});
}
});
1.0.0 / 2013-01-24
==================
* remove lame magical getters
0.0.1 / 2010-01-03
==================
* Initial release
test:
@./node_modules/.bin/mocha \
--require should
.PHONY: test
\ No newline at end of file
# callstack
Access to v8's "raw" `CallSite`s.
## Installation
$ npm install callsite
## Example
```js
var stack = require('callsite');
foo();
function foo() {
bar();
}
function bar() {
baz();
}
function baz() {
console.log();
stack().forEach(function(site){
console.log(' \033[36m%s\033[90m in %s:%d\033[0m'
, site.getFunctionName() || 'anonymous'
, site.getFileName()
, site.getLineNumber());
});
console.log();
}
```
## Why?
Because you can do weird, stupid, clever, wacky things such as:
- [better-assert](https://github.com/visionmedia/better-assert)
## License
MIT
module.exports = function(){
var orig = Error.prepareStackTrace;
Error.prepareStackTrace = function(_, stack){ return stack; };
var err = new Error;
Error.captureStackTrace(err, arguments.callee);
var stack = err.stack;
Error.prepareStackTrace = orig;
return stack;
};
{
"_from": "callsite@1.0.0",
"_id": "callsite@1.0.0",
"_inBundle": false,
"_integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=",
"_location": "/callsite",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "callsite@1.0.0",
"name": "callsite",
"escapedName": "callsite",
"rawSpec": "1.0.0",
"saveSpec": null,
"fetchSpec": "1.0.0"
},
"_requiredBy": [
"/better-assert"
],
"_resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz",
"_shasum": "280398e5d664bd74038b6f0905153e6e8af1bc20",
"_spec": "callsite@1.0.0",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\better-assert",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "access to v8's CallSites",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"engines": {
"node": "*"
},
"keywords": [
"stack",
"trace",
"line"
],
"main": "index",
"name": "callsite",
"version": "1.0.0"
}
1.0.0 / 2014-05-27
==================
* index: use slice ref (#7, @viatropos)
* package: rename package to "component-bind"
* package: add "repository" field (#6, @repoify)
* package: add "component" section
0.0.1 / 2010-01-03
==================
* Initial release
test:
@./node_modules/.bin/mocha \
--require should \
--reporter spec
.PHONY: test
\ No newline at end of file
# bind
Function binding utility.
## Installation
```
$ component install component/bind
```
## API
- [bind(obj, fn)](#bindobj-fn)
- [bind(obj, fn, ...)](#bindobj-fn-)
- [bind(obj, name)](#bindobj-name)
<a name=""></a>
<a name="bindobj-fn"></a>
### bind(obj, fn)
should bind the function to the given object.
```js
var tobi = { name: 'tobi' };
function name() {
return this.name;
}
var fn = bind(tobi, name);
fn().should.equal('tobi');
```
<a name="bindobj-fn-"></a>
### bind(obj, fn, ...)
should curry the remaining arguments.
```js
function add(a, b) {
return a + b;
}
bind(null, add)(1, 2).should.equal(3);
bind(null, add, 1)(2).should.equal(3);
bind(null, add, 1, 2)().should.equal(3);
```
<a name="bindobj-name"></a>
### bind(obj, name)
should bind the method of the given name.
```js
var tobi = { name: 'tobi' };
tobi.getName = function() {
return this.name;
};
var fn = bind(tobi, 'getName');
fn().should.equal('tobi');
```
## License
MIT
\ No newline at end of file
{
"name": "bind",
"version": "1.0.0",
"description": "function binding utility",
"keywords": [
"bind",
"utility"
],
"dependencies": {},
"scripts": [
"index.js"
]
}
/**
* Slice reference.
*/
var slice = [].slice;
/**
* Bind `obj` to `fn`.
*
* @param {Object} obj
* @param {Function|String} fn or string
* @return {Function}
* @api public
*/
module.exports = function(obj, fn){
if ('string' == typeof fn) fn = obj[fn];
if ('function' != typeof fn) throw new Error('bind() requires a function');
var args = slice.call(arguments, 2);
return function(){
return fn.apply(obj, args.concat(slice.call(arguments)));
}
};
{
"_from": "component-bind@1.0.0",
"_id": "component-bind@1.0.0",
"_inBundle": false,
"_integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=",
"_location": "/component-bind",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "component-bind@1.0.0",
"name": "component-bind",
"escapedName": "component-bind",
"rawSpec": "1.0.0",
"saveSpec": null,
"fetchSpec": "1.0.0"
},
"_requiredBy": [
"/socket.io-client"
],
"_resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz",
"_shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1",
"_spec": "component-bind@1.0.0",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\socket.io-client",
"bugs": {
"url": "https://github.com/component/bind/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"bind/index.js": "index.js"
}
},
"deprecated": false,
"description": "function binding utility",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"homepage": "https://github.com/component/bind#readme",
"keywords": [
"bind",
"utility"
],
"name": "component-bind",
"repository": {
"type": "git",
"url": "git+https://github.com/component/bind.git"
},
"version": "1.0.0"
}
1.2.1 / 2016-04-18
==================
* enable client side use
1.2.0 / 2014-02-12
==================
* prefix events with `$` to support object prototype method names
1.1.3 / 2014-06-20
==================
* republish for npm
* add LICENSE file
1.1.2 / 2014-02-10
==================
* package: rename to "component-emitter"
* package: update "main" and "component" fields
* Add license to Readme (same format as the other components)
* created .npmignore
* travis stuff
1.1.1 / 2013-12-01
==================
* fix .once adding .on to the listener
* docs: Emitter#off()
* component: add `.repo` prop
1.1.0 / 2013-10-20
==================
* add `.addEventListener()` and `.removeEventListener()` aliases
1.0.1 / 2013-06-27
==================
* add support for legacy ie
1.0.0 / 2013-02-26
==================
* add `.off()` support for removing all listeners
0.0.6 / 2012-10-08
==================
* add `this._callbacks` initialization to prevent funky gotcha
0.0.5 / 2012-09-07
==================
* fix `Emitter.call(this)` usage
0.0.3 / 2012-07-11
==================
* add `.listeners()`
* rename `.has()` to `.hasListeners()`
0.0.2 / 2012-06-28
==================
* fix `.off()` with `.once()`-registered callbacks
(The MIT License)
Copyright (c) 2014 Component contributors <dev@component.io>
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.
# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter)
Event emitter component.
## Installation
```
$ component install component/emitter
```
## API
### Emitter(obj)
The `Emitter` may also be used as a mixin. For example
a "plain" object may become an emitter, or you may
extend an existing prototype.
As an `Emitter` instance:
```js
var Emitter = require('emitter');
var emitter = new Emitter;
emitter.emit('something');
```
As a mixin:
```js
var Emitter = require('emitter');
var user = { name: 'tobi' };
Emitter(user);
user.emit('im a user');
```
As a prototype mixin:
```js
var Emitter = require('emitter');
Emitter(User.prototype);
```
### Emitter#on(event, fn)
Register an `event` handler `fn`.
### Emitter#once(event, fn)
Register a single-shot `event` handler `fn`,
removed immediately after it is invoked the
first time.
### Emitter#off(event, fn)
* Pass `event` and `fn` to remove a listener.
* Pass `event` to remove all listeners on that event.
* Pass nothing to remove all listeners on all events.
### Emitter#emit(event, ...)
Emit an `event` with variable option args.
### Emitter#listeners(event)
Return an array of callbacks, or an empty array.
### Emitter#hasListeners(event)
Check if this emitter has `event` handlers.
## License
MIT
/**
* Expose `Emitter`.
*/
if (typeof module !== 'undefined') {
module.exports = Emitter;
}
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
};
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
}
// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = [].slice.call(arguments, 1)
, callbacks = this._callbacks['$' + event];
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
{
"_from": "component-emitter@1.2.1",
"_id": "component-emitter@1.2.1",
"_inBundle": false,
"_integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
"_location": "/component-emitter",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "component-emitter@1.2.1",
"name": "component-emitter",
"escapedName": "component-emitter",
"rawSpec": "1.2.1",
"saveSpec": null,
"fetchSpec": "1.2.1"
},
"_requiredBy": [
"/socket.io-client",
"/socket.io-parser"
],
"_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
"_shasum": "137918d6d78283f7df7a6b7c5a63e140e69425e6",
"_spec": "component-emitter@1.2.1",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\socket.io-client",
"bugs": {
"url": "https://github.com/component/emitter/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"emitter/index.js": "index.js"
}
},
"deprecated": false,
"description": "Event emitter",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"files": [
"index.js",
"LICENSE"
],
"homepage": "https://github.com/component/emitter#readme",
"license": "MIT",
"main": "index.js",
"name": "component-emitter",
"repository": {
"type": "git",
"url": "git+https://github.com/component/emitter.git"
},
"scripts": {
"test": "make test"
},
"version": "1.2.1"
}
0.0.2 / 2012-09-03
==================
* fix typo in package.json
build: components index.js
@component build
components:
@Component install
clean:
rm -fr build components template.js
test:
@node_modules/.bin/mocha \
--require should \
--reporter spec
.PHONY: clean test
# inherit
Prototype inheritance utility.
## Installation
```
$ component install component/inherit
```
## Example
```js
var inherit = require('inherit');
function Human() {}
function Woman() {}
inherit(Woman, Human);
```
## License
MIT
{
"name": "inherit",
"description": "Prototype inheritance utility",
"version": "0.0.3",
"keywords": ["inherit", "utility"],
"dependencies": {},
"scripts": [
"index.js"
]
}
module.exports = function(a, b){
var fn = function(){};
fn.prototype = b.prototype;
a.prototype = new fn;
a.prototype.constructor = a;
};
\ No newline at end of file
{
"_from": "component-inherit@0.0.3",
"_id": "component-inherit@0.0.3",
"_inBundle": false,
"_integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=",
"_location": "/component-inherit",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "component-inherit@0.0.3",
"name": "component-inherit",
"escapedName": "component-inherit",
"rawSpec": "0.0.3",
"saveSpec": null,
"fetchSpec": "0.0.3"
},
"_requiredBy": [
"/engine.io-client"
],
"_resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz",
"_shasum": "645fc4adf58b72b649d5cae65135619db26ff143",
"_spec": "component-inherit@0.0.3",
"_where": "C:\\Users\\rkdud\\Desktop\\batch_file\\node_modules\\engine.io-client",
"bugs": {
"url": "https://github.com/component/inherit/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"inherit/index.js": "index.js"
}
},
"dependencies": {},
"deprecated": false,
"description": "Prototype inheritance utility",
"homepage": "https://github.com/component/inherit#readme",
"keywords": [
"inherit",
"utility"
],
"name": "component-inherit",
"repository": {
"type": "git",
"url": "git+https://github.com/component/inherit.git"
},
"version": "0.0.3"
}
/**
* Module dependencies.
*/
var inherit = require('..');
describe('inherit(a, b)', function(){
it('should inherit b\'s prototype', function(){
function Loki(){}
function Animal(){}
Animal.prototype.species = 'unknown';
inherit(Loki, Animal);
var loki = new Loki;
loki.species.should.equal('unknown');
loki.constructor.should.equal(Loki);
})
})
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.