TheDesk Riina (ver.2)
This commit is contained in:
parent
0a234d14d4
commit
0ada3a03b0
6
LATEST.md
Normal file
6
LATEST.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
[TheDesk](https://thedesk.top) :thedesk: Riina (ver.2)
|
||||
・バグ修正(アップデータやレイアウトなど)
|
||||
・URLコピーを時間表示部に変更(公式への追従)
|
||||
・アニメーションアイコンを再生するかの設定
|
||||
|
||||
:github: [cutls/TheDesk](https://github.com/cutls/TheDesk) #Desk #DeskUpdate
|
|
@ -1,14 +0,0 @@
|
|||
[TheDesk](https://thedesk.top) :thedesk: Riina (ver.1)
|
||||
コードネーム変更です(内部verは12)。この次のコードネームはAiriです。
|
||||
+ UIを大幅刷新しています。
|
||||
+ 全体的にコンパクトになりました。もしかしたら文字サイズを下げたほうが見やすいかもしれません。
|
||||
+ via表示が長い場合は省略します。カーソルを合わせると全て表示します。
|
||||
+ 左下にそのトゥートの公開情報が表示されます。アイコンの説明はカーソルを合わせると確認できます。
|
||||
+ トゥートの公開情報のアイコンを押すと,そのトゥートのURLがコピーされます。
|
||||
+ トゥートボックスの上部の青いプロフのボタンで自分のプロフィールを確認
|
||||
+ URLスキームに対応(thedesk://)
|
||||
+ これによりログイン時にコードを貼り付ける必要がなくなりました。"Electronで開く"を押して下さい。
|
||||
+ thedesk://user/?code=**ユーザーID**でユーザーデータが開きます。
|
||||
+ 一部バグ修正
|
||||
|
||||
:github: [cutls/TheDesk](https://github.com/cutls/TheDesk) #Desk #DeskUpdate
|
|
@ -45,7 +45,7 @@ iframe {
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: 43px 1fr 0.5fr;
|
||||
grid-template-columns: 43px 2fr 1fr;
|
||||
grid-template-areas: 'notice notice notice' 'icon display_name acct' 'icon toot toot' 'icon date_via date_via' 'actions actions actions';
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,9 @@ grid-area: icon;
|
|||
}
|
||||
|
||||
.area-display_name {
|
||||
height:1.2em;
|
||||
height:1.4em;
|
||||
margin:2px;
|
||||
overflow:hidden;
|
||||
grid-area: display_name;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
@ -71,6 +72,7 @@ text-overflow: ellipsis;
|
|||
.area-acct {
|
||||
margin:2px;
|
||||
grid-area: acct;
|
||||
overflow:hidden;
|
||||
text-align:right;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<script type="text/javascript" src="./js/common/keyshortcut.js"></script>
|
||||
<script type="text/javascript" src="./js/common/modal.js"></script>
|
||||
<script>
|
||||
var ver="Riina (ver.1[fixed])";
|
||||
var ver="Riina (ver.2)";
|
||||
//betaを入れるとバージョンチェックしない
|
||||
//var ver="beta";
|
||||
var acct_id=0;
|
||||
|
|
|
@ -54,13 +54,14 @@ function mixtl(acct_id, tlid) {
|
|||
Object.keys(locals).forEach(function(key2) {
|
||||
if (!$("#timeline_" + tlid + " [toot-id=" + obj[0].id + "]").length &&
|
||||
key2 < date(obj[0].created_at, 'unix')) {
|
||||
$("#timeline_" + tlid + " .cvo").first().prepend(parse([obj[0]],
|
||||
$("#timeline_" + tlid + " .cvo").first().before(parse([obj[0]],
|
||||
'home', acct_id));
|
||||
}
|
||||
if (!$("#timeline_" + tlid + " [toot-id=" + toot.id + "]").length) {
|
||||
if (key2 > tarunix) {
|
||||
var local = locals[key2];
|
||||
$("#timeline_" + tlid + " [toot-id=" + local + "]").append(parse(
|
||||
console.log("#timeline_" + tlid + " [toot-id=" + local + "]");
|
||||
$("#timeline_" + tlid + " [toot-id=" + local + "]").after(parse(
|
||||
[toot], 'home', acct_id));
|
||||
tarunix = 0;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ function parse(obj, mix, acct_id) {
|
|||
var datetype = localStorage.getItem("datetype");
|
||||
var nsfwtype = localStorage.getItem("nsfw");
|
||||
var sent = localStorage.getItem("sentence");
|
||||
var gif = localStorage.getItem("gif");
|
||||
if (!sent) {
|
||||
var sent = 500;
|
||||
}
|
||||
|
@ -21,6 +22,9 @@ function parse(obj, mix, acct_id) {
|
|||
if (!datetype) {
|
||||
datetype = "absolute";
|
||||
}
|
||||
if(!gif){
|
||||
var gif="yes";
|
||||
}
|
||||
var local = [];
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var toot = obj[key];
|
||||
|
@ -150,13 +154,13 @@ function parse(obj, mix, acct_id) {
|
|||
var vis="";
|
||||
var visen=toot.visibility;
|
||||
if(visen=="public"){
|
||||
var vis = '<i class="text-darken-3 material-icons gray sml pointer" title="公開(クリックでトゥートURLをコピー)" onclick="tootUriCopy(\''+toot.url+'\');">public</i>';
|
||||
var vis = '<i class="text-darken-3 material-icons gray sml" title="公開">public</i>';
|
||||
}else if(visen=="unlisted"){
|
||||
var vis = '<i class="text-darken-3 material-icons blue-text pointer" title="未収載(クリックでトゥートURLをコピー)" onclick="tootUriCopy(\''+toot.url+'\');">lock_open</i>';
|
||||
var vis = '<i class="text-darken-3 material-icons blue-text" title="未収載">lock_open</i>';
|
||||
}else if(visen=="plivate"){
|
||||
var vis = '<i class="text-darken-3 material-icons orange-text pointer" title="非公開(クリックでトゥートURLをコピー)" onclick="tootUriCopy(\''+toot.url+'\');">lock</i>';
|
||||
var vis = '<i class="text-darken-3 material-icons orange-text" title="非公開">lock</i>';
|
||||
}else if(visen=="direct"){
|
||||
var vis = '<i class="text-darken-3 material-icons red-text pointer" title="ダイレクト(クリックでトゥートURLをコピー)" onclick="tootUriCopy(\''+toot.url+'\');">mail</i>';
|
||||
var vis = '<i class="text-darken-3 material-icons red-text" title="ダイレクト">mail</i>';
|
||||
}
|
||||
if (toot.account.acct == localStorage.getItem("user_" + acct_id)) {
|
||||
var if_mine = "";
|
||||
|
@ -177,6 +181,12 @@ function parse(obj, mix, acct_id) {
|
|||
var if_rt = "";
|
||||
var rt_app = "";
|
||||
}
|
||||
//アニメ再生
|
||||
if(gif=="yes"){
|
||||
var avatar=toot.account.avatar;
|
||||
}else{
|
||||
var avatar=toot.account.avatar_static;
|
||||
}
|
||||
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
|
||||
boostback + ' ' + fav_app + ' ' + rt_app +
|
||||
' '+ hasmedia + '" toot-id="' + id + '" unixtime="' + date(obj[
|
||||
|
@ -184,7 +194,7 @@ function parse(obj, mix, acct_id) {
|
|||
'<div class="area-notice"><span class="gray sharesta">' + notice + home + '</span></div>'+
|
||||
'<div class="area-icon"><a onclick="udg(\'' + toot.account.id +
|
||||
'\',' + acct_id + ');" user="' + toot.account.acct + '" class="udg">' +
|
||||
'<img src="' + toot.account.avatar +
|
||||
'<img src="' + avatar +
|
||||
'" width="40" class="prof-img" user="' + toot.account.acct +
|
||||
'"></a></div>'+
|
||||
'<div class="area-display_name"><span class="user">' +
|
||||
|
@ -214,11 +224,11 @@ function parse(obj, mix, acct_id) {
|
|||
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa fa-trash-o"></i></a></div>' +
|
||||
'<div class="action"><a onclick="details(\'' + toot.id + '\',' + acct_id +
|
||||
')" class="waves-effect waves-dark btn-flat details" style="padding:0"><i class="text-darken-3 material-icons">more_vert</i></a></div>' +
|
||||
'<div><span class="cbadge"><i class="fa fa-clock-o"></i>' +
|
||||
'<div><span class="cbadge pointer" onclick="tootUriCopy(\''+toot.url+'\');" title="クリックでトゥートURLをコピー"><i class="fa fa-clock-o"></i>' +
|
||||
date(toot.created_at, datetype) + '</span></div>' +
|
||||
'<div><span class="cbadge" title="via ' + $.strip_tags(via) + '">via ' + via +
|
||||
'</span></div></div></div>'+
|
||||
'</div><div class="divider"></div>';
|
||||
'<div class="divider"></div></div>';
|
||||
});
|
||||
if (mix == "mix") {
|
||||
return [templete, local]
|
||||
|
|
|
@ -45,6 +45,11 @@ function settings() {
|
|||
Materialize.toast("デフォルトでボックスを隠すかを" + boxd + "に設定しました。", 3000);
|
||||
}
|
||||
localStorage.setItem("box", boxd);
|
||||
var gifd = $("[name=gif]:checked").val();
|
||||
if (gifd != localStorage.getItem("gif")) {
|
||||
Materialize.toast("アイコンアニメーション再生を" + gifd + "に設定しました。", 3000);
|
||||
}
|
||||
localStorage.setItem("gif", gifd);
|
||||
var sentd = $("#sentence").val();
|
||||
if (sentd != localStorage.getItem("sentence")) {
|
||||
Materialize.toast("指定行超過折りたたみを" + sentd + "行に設定しました。", 3000);
|
||||
|
@ -107,6 +112,12 @@ function load() {
|
|||
}
|
||||
$("#b_" + box).prop("checked", true);
|
||||
|
||||
var gif = localStorage.getItem("gif");
|
||||
if (!gif) {
|
||||
var gif = "yes";
|
||||
}
|
||||
$("#g_" + gif).prop("checked", true);
|
||||
|
||||
var sent = localStorage.getItem("sentence");
|
||||
if (!sent) {
|
||||
var sent = "500";
|
||||
|
|
14
app/main.js
14
app/main.js
|
@ -99,14 +99,24 @@ ipc.on('download-btn', (e, args) => {
|
|||
properties: ['openFile', 'createDirectory'],
|
||||
defaultPath: 'TheDesk-win32-x64.zip'
|
||||
}, (savedFiles) => {
|
||||
dl(savedFiles[0]);
|
||||
console.log();
|
||||
|
||||
var m = savedFiles.match(/(.+)\\(.+)$/);
|
||||
try {
|
||||
fs.statSync(savedFiles);
|
||||
fs.unlink(savedFiles);
|
||||
return true
|
||||
} catch(err) {
|
||||
if(err.code === 'ENOENT') return false
|
||||
}
|
||||
dl(m[1],savedFiles);
|
||||
});
|
||||
}else{
|
||||
dl();
|
||||
}
|
||||
|
||||
});
|
||||
function dl(files){
|
||||
function dl(files,fullname){
|
||||
console.log(files);
|
||||
mainWindow.webContents.send('comp', "ダウンロードを開始します。");
|
||||
const opts = {
|
||||
|
|
15
app/node_modules/.bin/mkdirp
generated
vendored
Normal file
15
app/node_modules/.bin/mkdirp
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../mkdirp/bin/cmd.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
app/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
7
app/node_modules/.bin/mkdirp.cmd
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\mkdirp\bin\cmd.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\mkdirp\bin\cmd.js" %*
|
||||
)
|
15
app/node_modules/.bin/rimraf
generated
vendored
Normal file
15
app/node_modules/.bin/rimraf
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../rimraf/bin.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../rimraf/bin.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
app/node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
7
app/node_modules/.bin/rimraf.cmd
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\rimraf\bin.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\rimraf\bin.js" %*
|
||||
)
|
5
app/node_modules/balanced-match/.npmignore
generated
vendored
Normal file
5
app/node_modules/balanced-match/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
test
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Makefile
|
||||
example.js
|
21
app/node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
app/node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
91
app/node_modules/balanced-match/README.md
generated
vendored
Normal file
91
app/node_modules/balanced-match/README.md
generated
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
# balanced-match
|
||||
|
||||
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||
|
||||
[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
|
||||
[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
|
||||
|
||||
[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
|
||||
|
||||
## Example
|
||||
|
||||
Get the first matching pair of braces:
|
||||
|
||||
```js
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||
```
|
||||
|
||||
The matches are:
|
||||
|
||||
```bash
|
||||
$ node example.js
|
||||
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||
{ start: 3,
|
||||
end: 9,
|
||||
pre: 'pre',
|
||||
body: 'first',
|
||||
post: 'between{second}post' }
|
||||
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### var m = balanced(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
object with those keys:
|
||||
|
||||
* **start** the index of the first match of `a`
|
||||
* **end** the index of the matching `b`
|
||||
* **pre** the preamble, `a` and `b` not included
|
||||
* **body** the match, `a` and `b` not included
|
||||
* **post** the postscript, `a` and `b` not included
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||
|
||||
### var r = balanced.range(a, b, str)
|
||||
|
||||
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||
array with indexes: `[ <a index>, <b index> ]`.
|
||||
|
||||
If there's no match, `undefined` will be returned.
|
||||
|
||||
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install balanced-match
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
59
app/node_modules/balanced-match/index.js
generated
vendored
Normal file
59
app/node_modules/balanced-match/index.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
module.exports = balanced;
|
||||
function balanced(a, b, str) {
|
||||
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||
|
||||
var r = range(a, b, str);
|
||||
|
||||
return r && {
|
||||
start: r[0],
|
||||
end: r[1],
|
||||
pre: str.slice(0, r[0]),
|
||||
body: str.slice(r[0] + a.length, r[1]),
|
||||
post: str.slice(r[1] + b.length)
|
||||
};
|
||||
}
|
||||
|
||||
function maybeMatch(reg, str) {
|
||||
var m = str.match(reg);
|
||||
return m ? m[0] : null;
|
||||
}
|
||||
|
||||
balanced.range = range;
|
||||
function range(a, b, str) {
|
||||
var begs, beg, left, right, result;
|
||||
var ai = str.indexOf(a);
|
||||
var bi = str.indexOf(b, ai + 1);
|
||||
var i = ai;
|
||||
|
||||
if (ai >= 0 && bi > 0) {
|
||||
begs = [];
|
||||
left = str.length;
|
||||
|
||||
while (i >= 0 && !result) {
|
||||
if (i == ai) {
|
||||
begs.push(i);
|
||||
ai = str.indexOf(a, i + 1);
|
||||
} else if (begs.length == 1) {
|
||||
result = [ begs.pop(), bi ];
|
||||
} else {
|
||||
beg = begs.pop();
|
||||
if (beg < left) {
|
||||
left = beg;
|
||||
right = bi;
|
||||
}
|
||||
|
||||
bi = str.indexOf(b, i + 1);
|
||||
}
|
||||
|
||||
i = ai < bi && ai >= 0 ? ai : bi;
|
||||
}
|
||||
|
||||
if (begs.length) {
|
||||
result = [ left, right ];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
112
app/node_modules/balanced-match/package.json
generated
vendored
Normal file
112
app/node_modules/balanced-match/package.json
generated
vendored
Normal file
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "balanced-match@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "balanced-match",
|
||||
"name": "balanced-match",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\brace-expansion"
|
||||
]
|
||||
],
|
||||
"_from": "balanced-match@>=1.0.0 <2.0.0",
|
||||
"_id": "balanced-match@1.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/balanced-match",
|
||||
"_nodeVersion": "7.8.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "s3://npm-registry-packages",
|
||||
"tmp": "tmp/balanced-match-1.0.0.tgz_1497251909645_0.8755026108119637"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
"_npmVersion": "4.2.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "balanced-match@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "balanced-match",
|
||||
"name": "balanced-match",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"_shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "balanced-match@^1.0.0",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\brace-expansion",
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "89b4d199ab2bee49de164ea02b89ce462d71b767",
|
||||
"tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz"
|
||||
},
|
||||
"gitHead": "d701a549a7653a874eebce7eca25d3577dc868ac",
|
||||
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||
"keywords": [
|
||||
"match",
|
||||
"regexp",
|
||||
"test",
|
||||
"balanced",
|
||||
"parse"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
}
|
||||
],
|
||||
"name": "balanced-match",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "make bench",
|
||||
"test": "make test"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
1
app/node_modules/binary/.npmignore
generated
vendored
Normal file
1
app/node_modules/binary/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
4
app/node_modules/binary/.travis.yml
generated
vendored
Normal file
4
app/node_modules/binary/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.4
|
||||
- 0.6
|
177
app/node_modules/binary/README.markdown
generated
vendored
Normal file
177
app/node_modules/binary/README.markdown
generated
vendored
Normal file
|
@ -0,0 +1,177 @@
|
|||
binary
|
||||
======
|
||||
|
||||
Unpack multibyte binary values from buffers and streams.
|
||||
You can specify the endianness and signedness of the fields to be unpacked too.
|
||||
|
||||
This module is a cleaner and more complete version of
|
||||
[bufferlist](https://github.com/substack/node-bufferlist)'s binary module that
|
||||
runs on pre-allocated buffers instead of a linked list.
|
||||
|
||||
[![build status](https://secure.travis-ci.org/substack/node-binary.png)](http://travis-ci.org/substack/node-binary)
|
||||
|
||||
examples
|
||||
========
|
||||
|
||||
stream.js
|
||||
---------
|
||||
|
||||
``` js
|
||||
var binary = require('binary');
|
||||
|
||||
var ws = binary()
|
||||
.word32lu('x')
|
||||
.word16bs('y')
|
||||
.word16bu('z')
|
||||
.tap(function (vars) {
|
||||
console.dir(vars);
|
||||
})
|
||||
;
|
||||
process.stdin.pipe(ws);
|
||||
process.stdin.resume();
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
$ node examples/stream.js
|
||||
abcdefgh
|
||||
{ x: 1684234849, y: 25958, z: 26472 }
|
||||
^D
|
||||
```
|
||||
|
||||
parse.js
|
||||
--------
|
||||
|
||||
``` js
|
||||
var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
|
||||
|
||||
var binary = require('binary');
|
||||
var vars = binary.parse(buf)
|
||||
.word16ls('ab')
|
||||
.word32bu('cf')
|
||||
.word8('x')
|
||||
.vars
|
||||
;
|
||||
console.dir(vars);
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
{ ab: 25185, cf: 1667523942, x: 0 }
|
||||
```
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
`var binary = require('binary')`
|
||||
|
||||
var b = binary()
|
||||
----------------
|
||||
|
||||
Return a new writable stream `b` that has the chainable methods documented below
|
||||
for buffering binary input.
|
||||
|
||||
binary.parse(buf)
|
||||
-----------------
|
||||
|
||||
Parse a static buffer in one pass. Returns a chainable interface with the
|
||||
methods below plus a `vars` field to get at the variable stash as the last item
|
||||
in a chain.
|
||||
|
||||
In parse mode, methods will set their keys to `null` if the buffer isn't big
|
||||
enough except `buffer()` and `scan()` which read up up to the end of the buffer
|
||||
and stop.
|
||||
|
||||
b.word{8,16,32,64}{l,b}{e,u,s}(key)
|
||||
-----------------------------------
|
||||
|
||||
Parse bytes in the buffer or stream given:
|
||||
|
||||
* number of bits
|
||||
* endianness ( l : little, b : big ),
|
||||
* signedness ( u and e : unsigned, s : signed )
|
||||
|
||||
These functions won't start parsing until all previous parser functions have run
|
||||
and the data is available.
|
||||
|
||||
The result of the parse goes into the variable stash at `key`.
|
||||
If `key` has dots (`.`s), it refers to a nested address. If parent container
|
||||
values don't exist they will be created automatically, so for instance you can
|
||||
assign into `dst.addr` and `dst.port` and the `dst` key in the variable stash
|
||||
will be `{ addr : x, port : y }` afterwards.
|
||||
|
||||
b.buffer(key, size)
|
||||
-------------------
|
||||
|
||||
Take `size` bytes directly off the buffer stream, putting the resulting buffer
|
||||
slice in the variable stash at `key`. If `size` is a string, use the value at
|
||||
`vars[size]`. The key follows the same dotted address rules as the word
|
||||
functions.
|
||||
|
||||
b.scan(key, buffer)
|
||||
-------------------
|
||||
|
||||
Search for `buffer` in the stream and store all the intervening data in the
|
||||
stash at at `key`, excluding the search buffer. If `buffer` passed as a string,
|
||||
it will be converted into a Buffer internally.
|
||||
|
||||
For example, to read in a line you can just do:
|
||||
|
||||
``` js
|
||||
var b = binary()
|
||||
.scan('line', new Buffer('\r\n'))
|
||||
.tap(function (vars) {
|
||||
console.log(vars.line)
|
||||
})
|
||||
;
|
||||
stream.pipe(b);
|
||||
```
|
||||
|
||||
b.tap(cb)
|
||||
---------
|
||||
|
||||
The callback `cb` is provided with the variable stash from all the previous
|
||||
actions once they've all finished.
|
||||
|
||||
You can nest additional actions onto `this` inside the callback.
|
||||
|
||||
b.into(key, cb)
|
||||
---------------
|
||||
|
||||
Like `.tap()`, except all nested actions will assign into a `key` in the `vars`
|
||||
stash.
|
||||
|
||||
b.loop(cb)
|
||||
----------
|
||||
|
||||
Loop, each time calling `cb(end, vars)` for function `end` and the variable
|
||||
stash with `this` set to a new chain for nested parsing. The loop terminates
|
||||
once `end` is called.
|
||||
|
||||
b.flush()
|
||||
---------
|
||||
|
||||
Clear the variable stash entirely.
|
||||
|
||||
installation
|
||||
============
|
||||
|
||||
To install with [npm](http://github.com/isaacs/npm):
|
||||
|
||||
```
|
||||
npm install binary
|
||||
```
|
||||
|
||||
notes
|
||||
=====
|
||||
|
||||
The word64 functions will only return approximations since javascript uses ieee
|
||||
floating point for all number types. Mind the loss of precision.
|
||||
|
||||
license
|
||||
=======
|
||||
|
||||
MIT
|
||||
|
11
app/node_modules/binary/example/buf.js
generated
vendored
Normal file
11
app/node_modules/binary/example/buf.js
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
|
||||
|
||||
var binary = require('binary');
|
||||
binary(buf)
|
||||
.word16ls('ab')
|
||||
.word32bu('cf')
|
||||
.word8('x')
|
||||
.tap(function (vars) {
|
||||
console.dir(vars);
|
||||
})
|
||||
;
|
10
app/node_modules/binary/example/parse.js
generated
vendored
Normal file
10
app/node_modules/binary/example/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
|
||||
|
||||
var binary = require('binary');
|
||||
var vars = binary.parse(buf)
|
||||
.word16ls('ab')
|
||||
.word32bu('cf')
|
||||
.word8('x')
|
||||
.vars
|
||||
;
|
||||
console.dir(vars);
|
12
app/node_modules/binary/example/stream.js
generated
vendored
Normal file
12
app/node_modules/binary/example/stream.js
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
var binary = require('binary');
|
||||
|
||||
var ws = binary()
|
||||
.word32lu('x')
|
||||
.word16bs('y')
|
||||
.word16bu('z')
|
||||
.tap(function (vars) {
|
||||
console.dir(vars);
|
||||
})
|
||||
;
|
||||
process.stdin.pipe(ws);
|
||||
process.stdin.resume();
|
397
app/node_modules/binary/index.js
generated
vendored
Normal file
397
app/node_modules/binary/index.js
generated
vendored
Normal file
|
@ -0,0 +1,397 @@
|
|||
var Chainsaw = require('chainsaw');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var Buffers = require('buffers');
|
||||
var Vars = require('./lib/vars.js');
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
exports = module.exports = function (bufOrEm, eventName) {
|
||||
if (Buffer.isBuffer(bufOrEm)) {
|
||||
return exports.parse(bufOrEm);
|
||||
}
|
||||
|
||||
var s = exports.stream();
|
||||
if (bufOrEm && bufOrEm.pipe) {
|
||||
bufOrEm.pipe(s);
|
||||
}
|
||||
else if (bufOrEm) {
|
||||
bufOrEm.on(eventName || 'data', function (buf) {
|
||||
s.write(buf);
|
||||
});
|
||||
|
||||
bufOrEm.on('end', function () {
|
||||
s.end();
|
||||
});
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
exports.stream = function (input) {
|
||||
if (input) return exports.apply(null, arguments);
|
||||
|
||||
var pending = null;
|
||||
function getBytes (bytes, cb, skip) {
|
||||
pending = {
|
||||
bytes : bytes,
|
||||
skip : skip,
|
||||
cb : function (buf) {
|
||||
pending = null;
|
||||
cb(buf);
|
||||
},
|
||||
};
|
||||
dispatch();
|
||||
}
|
||||
|
||||
var offset = null;
|
||||
function dispatch () {
|
||||
if (!pending) {
|
||||
if (caughtEnd) done = true;
|
||||
return;
|
||||
}
|
||||
if (typeof pending === 'function') {
|
||||
pending();
|
||||
}
|
||||
else {
|
||||
var bytes = offset + pending.bytes;
|
||||
|
||||
if (buffers.length >= bytes) {
|
||||
var buf;
|
||||
if (offset == null) {
|
||||
buf = buffers.splice(0, bytes);
|
||||
if (!pending.skip) {
|
||||
buf = buf.slice();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!pending.skip) {
|
||||
buf = buffers.slice(offset, bytes);
|
||||
}
|
||||
offset = bytes;
|
||||
}
|
||||
|
||||
if (pending.skip) {
|
||||
pending.cb();
|
||||
}
|
||||
else {
|
||||
pending.cb(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function builder (saw) {
|
||||
function next () { if (!done) saw.next() }
|
||||
|
||||
var self = words(function (bytes, cb) {
|
||||
return function (name) {
|
||||
getBytes(bytes, function (buf) {
|
||||
vars.set(name, cb(buf));
|
||||
next();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
self.tap = function (cb) {
|
||||
saw.nest(cb, vars.store);
|
||||
};
|
||||
|
||||
self.into = function (key, cb) {
|
||||
if (!vars.get(key)) vars.set(key, {});
|
||||
var parent = vars;
|
||||
vars = Vars(parent.get(key));
|
||||
|
||||
saw.nest(function () {
|
||||
cb.apply(this, arguments);
|
||||
this.tap(function () {
|
||||
vars = parent;
|
||||
});
|
||||
}, vars.store);
|
||||
};
|
||||
|
||||
self.flush = function () {
|
||||
vars.store = {};
|
||||
next();
|
||||
};
|
||||
|
||||
self.loop = function (cb) {
|
||||
var end = false;
|
||||
|
||||
saw.nest(false, function loop () {
|
||||
this.vars = vars.store;
|
||||
cb.call(this, function () {
|
||||
end = true;
|
||||
next();
|
||||
}, vars.store);
|
||||
this.tap(function () {
|
||||
if (end) saw.next()
|
||||
else loop.call(this)
|
||||
}.bind(this));
|
||||
}, vars.store);
|
||||
};
|
||||
|
||||
self.buffer = function (name, bytes) {
|
||||
if (typeof bytes === 'string') {
|
||||
bytes = vars.get(bytes);
|
||||
}
|
||||
|
||||
getBytes(bytes, function (buf) {
|
||||
vars.set(name, buf);
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
self.skip = function (bytes) {
|
||||
if (typeof bytes === 'string') {
|
||||
bytes = vars.get(bytes);
|
||||
}
|
||||
|
||||
getBytes(bytes, function () {
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
self.scan = function find (name, search) {
|
||||
if (typeof search === 'string') {
|
||||
search = new Buffer(search);
|
||||
}
|
||||
else if (!Buffer.isBuffer(search)) {
|
||||
throw new Error('search must be a Buffer or a string');
|
||||
}
|
||||
|
||||
var taken = 0;
|
||||
pending = function () {
|
||||
var pos = buffers.indexOf(search, offset + taken);
|
||||
var i = pos-offset-taken;
|
||||
if (pos !== -1) {
|
||||
pending = null;
|
||||
if (offset != null) {
|
||||
vars.set(
|
||||
name,
|
||||
buffers.slice(offset, offset + taken + i)
|
||||
);
|
||||
offset += taken + i + search.length;
|
||||
}
|
||||
else {
|
||||
vars.set(
|
||||
name,
|
||||
buffers.slice(0, taken + i)
|
||||
);
|
||||
buffers.splice(0, taken + i + search.length);
|
||||
}
|
||||
next();
|
||||
dispatch();
|
||||
} else {
|
||||
i = Math.max(buffers.length - search.length - offset - taken, 0);
|
||||
}
|
||||
taken += i;
|
||||
};
|
||||
dispatch();
|
||||
};
|
||||
|
||||
self.peek = function (cb) {
|
||||
offset = 0;
|
||||
saw.nest(function () {
|
||||
cb.call(this, vars.store);
|
||||
this.tap(function () {
|
||||
offset = null;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
var stream = Chainsaw.light(builder);
|
||||
stream.writable = true;
|
||||
|
||||
var buffers = Buffers();
|
||||
|
||||
stream.write = function (buf) {
|
||||
buffers.push(buf);
|
||||
dispatch();
|
||||
};
|
||||
|
||||
var vars = Vars();
|
||||
|
||||
var done = false, caughtEnd = false;
|
||||
stream.end = function () {
|
||||
caughtEnd = true;
|
||||
};
|
||||
|
||||
stream.pipe = Stream.prototype.pipe;
|
||||
Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function (name) {
|
||||
stream[name] = EventEmitter.prototype[name];
|
||||
});
|
||||
|
||||
return stream;
|
||||
};
|
||||
|
||||
exports.parse = function parse (buffer) {
|
||||
var self = words(function (bytes, cb) {
|
||||
return function (name) {
|
||||
if (offset + bytes <= buffer.length) {
|
||||
var buf = buffer.slice(offset, offset + bytes);
|
||||
offset += bytes;
|
||||
vars.set(name, cb(buf));
|
||||
}
|
||||
else {
|
||||
vars.set(name, null);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
});
|
||||
|
||||
var offset = 0;
|
||||
var vars = Vars();
|
||||
self.vars = vars.store;
|
||||
|
||||
self.tap = function (cb) {
|
||||
cb.call(self, vars.store);
|
||||
return self;
|
||||
};
|
||||
|
||||
self.into = function (key, cb) {
|
||||
if (!vars.get(key)) {
|
||||
vars.set(key, {});
|
||||
}
|
||||
var parent = vars;
|
||||
vars = Vars(parent.get(key));
|
||||
cb.call(self, vars.store);
|
||||
vars = parent;
|
||||
return self;
|
||||
};
|
||||
|
||||
self.loop = function (cb) {
|
||||
var end = false;
|
||||
var ender = function () { end = true };
|
||||
while (end === false) {
|
||||
cb.call(self, ender, vars.store);
|
||||
}
|
||||
return self;
|
||||
};
|
||||
|
||||
self.buffer = function (name, size) {
|
||||
if (typeof size === 'string') {
|
||||
size = vars.get(size);
|
||||
}
|
||||
var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
|
||||
offset += size;
|
||||
vars.set(name, buf);
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
self.skip = function (bytes) {
|
||||
if (typeof bytes === 'string') {
|
||||
bytes = vars.get(bytes);
|
||||
}
|
||||
offset += bytes;
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
self.scan = function (name, search) {
|
||||
if (typeof search === 'string') {
|
||||
search = new Buffer(search);
|
||||
}
|
||||
else if (!Buffer.isBuffer(search)) {
|
||||
throw new Error('search must be a Buffer or a string');
|
||||
}
|
||||
vars.set(name, null);
|
||||
|
||||
// simple but slow string search
|
||||
for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
|
||||
for (
|
||||
var j = 0;
|
||||
j < search.length && buffer[offset+i+j] === search[j];
|
||||
j++
|
||||
);
|
||||
if (j === search.length) break;
|
||||
}
|
||||
|
||||
vars.set(name, buffer.slice(offset, offset + i));
|
||||
offset += i + search.length;
|
||||
return self;
|
||||
};
|
||||
|
||||
self.peek = function (cb) {
|
||||
var was = offset;
|
||||
cb.call(self, vars.store);
|
||||
offset = was;
|
||||
return self;
|
||||
};
|
||||
|
||||
self.flush = function () {
|
||||
vars.store = {};
|
||||
return self;
|
||||
};
|
||||
|
||||
self.eof = function () {
|
||||
return offset >= buffer.length;
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
// convert byte strings to unsigned little endian numbers
|
||||
function decodeLEu (bytes) {
|
||||
var acc = 0;
|
||||
for (var i = 0; i < bytes.length; i++) {
|
||||
acc += Math.pow(256,i) * bytes[i];
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
// convert byte strings to unsigned big endian numbers
|
||||
function decodeBEu (bytes) {
|
||||
var acc = 0;
|
||||
for (var i = 0; i < bytes.length; i++) {
|
||||
acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
// convert byte strings to signed big endian numbers
|
||||
function decodeBEs (bytes) {
|
||||
var val = decodeBEu(bytes);
|
||||
if ((bytes[0] & 0x80) == 0x80) {
|
||||
val -= Math.pow(256, bytes.length);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
// convert byte strings to signed little endian numbers
|
||||
function decodeLEs (bytes) {
|
||||
var val = decodeLEu(bytes);
|
||||
if ((bytes[bytes.length - 1] & 0x80) == 0x80) {
|
||||
val -= Math.pow(256, bytes.length);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
function words (decode) {
|
||||
var self = {};
|
||||
|
||||
[ 1, 2, 4, 8 ].forEach(function (bytes) {
|
||||
var bits = bytes * 8;
|
||||
|
||||
self['word' + bits + 'le']
|
||||
= self['word' + bits + 'lu']
|
||||
= decode(bytes, decodeLEu);
|
||||
|
||||
self['word' + bits + 'ls']
|
||||
= decode(bytes, decodeLEs);
|
||||
|
||||
self['word' + bits + 'be']
|
||||
= self['word' + bits + 'bu']
|
||||
= decode(bytes, decodeBEu);
|
||||
|
||||
self['word' + bits + 'bs']
|
||||
= decode(bytes, decodeBEs);
|
||||
});
|
||||
|
||||
// word8be(n) == word8le(n) for all n
|
||||
self.word8 = self.word8u = self.word8be;
|
||||
self.word8s = self.word8bs;
|
||||
|
||||
return self;
|
||||
}
|
28
app/node_modules/binary/lib/vars.js
generated
vendored
Normal file
28
app/node_modules/binary/lib/vars.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
module.exports = function (store) {
|
||||
function getset (name, value) {
|
||||
var node = vars.store;
|
||||
var keys = name.split('.');
|
||||
keys.slice(0,-1).forEach(function (k) {
|
||||
if (node[k] === undefined) node[k] = {};
|
||||
node = node[k]
|
||||
});
|
||||
var key = keys[keys.length - 1];
|
||||
if (arguments.length == 1) {
|
||||
return node[key];
|
||||
}
|
||||
else {
|
||||
return node[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
var vars = {
|
||||
get : function (name) {
|
||||
return getset(name);
|
||||
},
|
||||
set : function (name, value) {
|
||||
return getset(name, value);
|
||||
},
|
||||
store : store || {},
|
||||
};
|
||||
return vars;
|
||||
};
|
102
app/node_modules/binary/package.json
generated
vendored
Normal file
102
app/node_modules/binary/package.json
generated
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "binary@>= 0.3.0 < 1",
|
||||
"scope": null,
|
||||
"escapedName": "binary",
|
||||
"name": "binary",
|
||||
"rawSpec": ">= 0.3.0 < 1",
|
||||
"spec": ">=0.3.0 <1.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\unzip"
|
||||
]
|
||||
],
|
||||
"_defaultsLoaded": true,
|
||||
"_engineSupported": true,
|
||||
"_from": "binary@>=0.3.0 <1.0.0",
|
||||
"_id": "binary@0.3.0",
|
||||
"_inCache": true,
|
||||
"_location": "/binary",
|
||||
"_nodeVersion": "v0.6.11",
|
||||
"_npmUser": {
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
},
|
||||
"_npmVersion": "1.1.19",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "binary@>= 0.3.0 < 1",
|
||||
"scope": null,
|
||||
"escapedName": "binary",
|
||||
"name": "binary",
|
||||
"rawSpec": ">= 0.3.0 < 1",
|
||||
"spec": ">=0.3.0 <1.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/unzip"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz",
|
||||
"_shasum": "9f60553bc5ce8c3386f3b553cff47462adecaa79",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "binary@>= 0.3.0 < 1",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\unzip",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-binary/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"buffers": "~0.1.1",
|
||||
"chainsaw": "~0.1.0"
|
||||
},
|
||||
"description": "Unpack multibyte binary values from buffers",
|
||||
"devDependencies": {
|
||||
"seq": "~0.2.5",
|
||||
"tap": "~0.2.4"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "9f60553bc5ce8c3386f3b553cff47462adecaa79",
|
||||
"tarball": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz"
|
||||
},
|
||||
"engine": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-binary#readme",
|
||||
"keywords": [
|
||||
"binary",
|
||||
"decode",
|
||||
"endian",
|
||||
"unpack",
|
||||
"signed",
|
||||
"unsigned"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
}
|
||||
],
|
||||
"name": "binary",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/node-binary.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
92
app/node_modules/binary/perf/loop.js
generated
vendored
Normal file
92
app/node_modules/binary/perf/loop.js
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
var Seq = require('seq');
|
||||
var Hash = require('hashish');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
var Bin = require('binary');
|
||||
var Buf = require('bufferlist/binary');
|
||||
var BufferList = require('bufferlist');
|
||||
|
||||
console.log('loop');
|
||||
function emitter () {
|
||||
var em = new EventEmitter;
|
||||
|
||||
var i = 0;
|
||||
var iv = setInterval(function () {
|
||||
var buf = new Buffer(10000);
|
||||
buf[0] = 0xff;
|
||||
|
||||
if (++ i >= 2000) {
|
||||
buf[0] = 0;
|
||||
clearInterval(iv);
|
||||
}
|
||||
em.emit('data', buf);
|
||||
}, 1);
|
||||
|
||||
return em;
|
||||
}
|
||||
|
||||
Seq()
|
||||
.seq(function () {
|
||||
var next = this.bind({}, null);
|
||||
bufferlist(next);
|
||||
})
|
||||
.seq(function () {
|
||||
var next = this.bind({}, null);
|
||||
binary(next);
|
||||
})
|
||||
;
|
||||
|
||||
function binary (next) {
|
||||
var em = emitter();
|
||||
var t0 = Date.now();
|
||||
|
||||
Bin(em)
|
||||
.loop(function (end) {
|
||||
this
|
||||
.word8('x')
|
||||
.word8('y')
|
||||
.word32be('z')
|
||||
.word32le('w')
|
||||
.buffer('buf', 10000 - 10)
|
||||
.tap(function (vars) {
|
||||
if (vars.x === 0) {
|
||||
var tf = Date.now();
|
||||
console.log(' binary: ' + (tf - t0) + ' ms');
|
||||
end();
|
||||
setTimeout(next, 20);
|
||||
}
|
||||
})
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
function bufferlist (next) {
|
||||
var em = emitter();
|
||||
var t0 = Date.now();
|
||||
|
||||
var blist = new BufferList;
|
||||
em.on('data', function (buf) {
|
||||
blist.push(buf);
|
||||
});
|
||||
|
||||
Buf(blist)
|
||||
.forever(function () {
|
||||
var top = this;
|
||||
this
|
||||
.getWord8('x')
|
||||
.getWord8('y')
|
||||
.getWord32be('z')
|
||||
.getWord32le('w')
|
||||
.getBuffer('buf', 10000 - 10)
|
||||
.tap(function (vars) {
|
||||
if (vars.x === 0) {
|
||||
var tf = Date.now();
|
||||
console.log(' bufferlist: ' + (tf - t0) + ' ms');
|
||||
top.exit();
|
||||
setTimeout(next, 20);
|
||||
}
|
||||
})
|
||||
})
|
||||
.end()
|
||||
;
|
||||
}
|
80
app/node_modules/binary/perf/small.js
generated
vendored
Normal file
80
app/node_modules/binary/perf/small.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
var Seq = require('seq');
|
||||
var Hash = require('hashish');
|
||||
|
||||
var Bin = require('binary');
|
||||
var Buf = require('bufferlist/binary');
|
||||
var BufferList = require('bufferlist');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
function binary (buf, cb) {
|
||||
Bin(buf)
|
||||
.word32le('x')
|
||||
.word16be('y')
|
||||
.word16be('z')
|
||||
.word32le('w')
|
||||
.tap(cb)
|
||||
;
|
||||
};
|
||||
|
||||
function stream (buf, cb) {
|
||||
var em = new EventEmitter;
|
||||
Bin(em)
|
||||
.word32le('x')
|
||||
.word16be('y')
|
||||
.word16be('z')
|
||||
.word32le('w')
|
||||
.tap(cb)
|
||||
;
|
||||
em.emit('data', buf);
|
||||
};
|
||||
|
||||
function parse (buf, cb) {
|
||||
cb(Bin.parse(buf)
|
||||
.word32le('x')
|
||||
.word16be('y')
|
||||
.word16be('z')
|
||||
.word32le('w')
|
||||
.vars
|
||||
);
|
||||
};
|
||||
|
||||
function bufferlist (buf, cb) {
|
||||
var blist = new BufferList;
|
||||
blist.push(buf);
|
||||
Buf(blist)
|
||||
.getWord32le('x')
|
||||
.getWord16be('y')
|
||||
.getWord16be('z')
|
||||
.getWord32le('w')
|
||||
.tap(cb)
|
||||
.end()
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
var buffers = [];
|
||||
for (var i = 0; i < 200; i++) {
|
||||
buffers.push(new Buffer(12));
|
||||
}
|
||||
|
||||
console.log('small');
|
||||
Seq(binary, stream, parse, bufferlist)
|
||||
.seqEach(function (f) {
|
||||
var t = this;
|
||||
var t0 = Date.now();
|
||||
Seq()
|
||||
.extend(buffers)
|
||||
.seqEach(function (buf) {
|
||||
f(buf, this.bind(this, null));
|
||||
})
|
||||
.seq(function () {
|
||||
var tf = Date.now();
|
||||
console.log(' ' + f.name + ': ' + (tf - t0));
|
||||
t(null);
|
||||
})
|
||||
;
|
||||
})
|
||||
.seq(function () {
|
||||
this(null);
|
||||
})
|
||||
;
|
46
app/node_modules/binary/test/bu.js
generated
vendored
Normal file
46
app/node_modules/binary/test/bu.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('bu', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
// note: can't store -12667700813876161 exactly in an ieee float
|
||||
|
||||
var buf = new Buffer([
|
||||
44, // a == 44
|
||||
2, 43, // b == 555
|
||||
164, 213, 37, 37, // c == 2765432101
|
||||
29, 81, 180, 20, 155, 115, 203, 193, // d == 2112667700813876161
|
||||
]);
|
||||
|
||||
binary.parse(buf)
|
||||
.word8bu('a')
|
||||
.word16bu('b')
|
||||
.word32bu('c')
|
||||
.word64bu('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 44);
|
||||
t.same(vars.b, 555);
|
||||
t.same(vars.c, 2765432101);
|
||||
t.ok(
|
||||
Math.abs(vars.d - 2112667700813876161) < 1500
|
||||
);
|
||||
})
|
||||
;
|
||||
|
||||
// also check aliases here:
|
||||
binary.parse(buf)
|
||||
.word8be('a')
|
||||
.word16be('b')
|
||||
.word32be('c')
|
||||
.word64be('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 44);
|
||||
t.same(vars.b, 555);
|
||||
t.same(vars.c, 2765432101);
|
||||
t.ok(
|
||||
Math.abs(vars.d - 2112667700813876161) < 1500
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
20
app/node_modules/binary/test/deferred.js
generated
vendored
Normal file
20
app/node_modules/binary/test/deferred.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('deferred', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var em = new EventEmitter;
|
||||
binary.stream(em)
|
||||
.word8('a')
|
||||
.word16be('bc')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { a : 97, bc : 25187 });
|
||||
})
|
||||
;
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 97, 98, 99 ]));
|
||||
}, 10);
|
||||
});
|
23
app/node_modules/binary/test/dots.js
generated
vendored
Normal file
23
app/node_modules/binary/test/dots.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('dots', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
binary.parse(new Buffer([ 97, 98, 99, 100, 101, 102 ]))
|
||||
.word8('a')
|
||||
.word16be('b.x')
|
||||
.word16be('b.y')
|
||||
.word8('b.z')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
a : 97,
|
||||
b : {
|
||||
x : 256 * 98 + 99,
|
||||
y : 256 * 100 + 101,
|
||||
z : 102
|
||||
},
|
||||
});
|
||||
})
|
||||
;
|
||||
});
|
41
app/node_modules/binary/test/eof.js
generated
vendored
Normal file
41
app/node_modules/binary/test/eof.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('eof', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var stream = new EventEmitter;
|
||||
binary.stream(stream)
|
||||
.buffer('sixone', 5)
|
||||
.peek(function () {
|
||||
this.word32le('len');
|
||||
})
|
||||
.buffer('buf', 'len')
|
||||
.word8('x')
|
||||
.tap(function (vars) {
|
||||
t.same(
|
||||
[].slice.call(vars.sixone),
|
||||
[].slice.call(new Buffer([ 6, 1, 6, 1, 6 ]))
|
||||
);
|
||||
t.same(vars.buf.length, vars.len);
|
||||
t.same(
|
||||
[].slice.call(vars.buf),
|
||||
[ 9, 0, 0, 0, 97, 98, 99, 100, 101 ]
|
||||
);
|
||||
t.same(vars.x, 102);
|
||||
})
|
||||
;
|
||||
|
||||
var bufs = [
|
||||
new Buffer([ 6, 1, 6, 1, 6, 9, 0, 0, 0, 97 ]),
|
||||
new Buffer([ 98, 99 ]),
|
||||
new Buffer([ 100, 101, 102 ]),
|
||||
];
|
||||
|
||||
bufs.forEach(function (buf) {
|
||||
stream.emit('data', buf);
|
||||
});
|
||||
|
||||
stream.emit('end');
|
||||
});
|
17
app/node_modules/binary/test/flush.js
generated
vendored
Normal file
17
app/node_modules/binary/test/flush.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('flush', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
binary.parse(new Buffer([ 97, 98, 99, 100, 101, 102 ]))
|
||||
.word8('a')
|
||||
.word16be('b')
|
||||
.word16be('c')
|
||||
.flush()
|
||||
.word8('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { d : 102 });
|
||||
})
|
||||
;
|
||||
});
|
14
app/node_modules/binary/test/from_buffer.js
generated
vendored
Normal file
14
app/node_modules/binary/test/from_buffer.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('from buffer', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
binary(new Buffer([ 97, 98, 99 ]))
|
||||
.word8('a')
|
||||
.word16be('bc')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { a : 97, bc : 25187 });
|
||||
})
|
||||
;
|
||||
});
|
28
app/node_modules/binary/test/get_buffer.js
generated
vendored
Normal file
28
app/node_modules/binary/test/get_buffer.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('get buffer', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var buf = new Buffer([ 4, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]);
|
||||
binary.parse(buf)
|
||||
.word8('a')
|
||||
.buffer('b', 7)
|
||||
.word16lu('c')
|
||||
.tap(function (vars) {
|
||||
t.equal(vars.a, 4);
|
||||
t.equal(
|
||||
vars.b.toString(),
|
||||
new Buffer([ 2, 3, 4, 5, 6, 7, 8 ]).toString()
|
||||
);
|
||||
t.equal(vars.c, 2569);
|
||||
})
|
||||
.buffer('d', 'a')
|
||||
.tap(function (vars) {
|
||||
t.equal(
|
||||
vars.d.toString(),
|
||||
new Buffer([ 11, 12, 13, 14 ]).toString()
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
18
app/node_modules/binary/test/immediate.js
generated
vendored
Normal file
18
app/node_modules/binary/test/immediate.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('immediate', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var em = new EventEmitter;
|
||||
binary.stream(em, 'moo')
|
||||
.word8('a')
|
||||
.word16be('bc')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { a : 97, bc : 25187 });
|
||||
})
|
||||
;
|
||||
|
||||
em.emit('moo', new Buffer([ 97, 98, 99 ]));
|
||||
});
|
38
app/node_modules/binary/test/interval.js
generated
vendored
Normal file
38
app/node_modules/binary/test/interval.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('interval', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var em = new EventEmitter;
|
||||
var i = 0;
|
||||
var iv = setInterval(function () {
|
||||
var buf = new Buffer(1000);
|
||||
buf[0] = 0xff;
|
||||
if (++i >= 1000) {
|
||||
clearInterval(iv);
|
||||
buf[0] = 0;
|
||||
}
|
||||
em.emit('data', buf);
|
||||
}, 1);
|
||||
|
||||
var loops = 0;
|
||||
binary(em)
|
||||
.loop(function (end) {
|
||||
this
|
||||
.word8('x')
|
||||
.word8('y')
|
||||
.word32be('z')
|
||||
.word32le('w')
|
||||
.buffer('buf', 1000 - 10)
|
||||
.tap(function (vars) {
|
||||
loops ++;
|
||||
if (vars.x == 0) end();
|
||||
})
|
||||
})
|
||||
.tap(function () {
|
||||
t.same(loops, 1000);
|
||||
})
|
||||
;
|
||||
});
|
35
app/node_modules/binary/test/into_buffer.js
generated
vendored
Normal file
35
app/node_modules/binary/test/into_buffer.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('intoBuffer', function (t) {
|
||||
t.plan(3);
|
||||
var buf = new Buffer([ 1, 2, 3, 4, 5, 6 ])
|
||||
|
||||
binary.parse(buf)
|
||||
.into('moo', function () {
|
||||
this
|
||||
.word8('x')
|
||||
.word8('y')
|
||||
.word8('z')
|
||||
;
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { moo : { x : 1, y : 2, z : 3 } });
|
||||
})
|
||||
.word8('w')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
moo : { x : 1, y : 2, z : 3 },
|
||||
w : 4,
|
||||
});
|
||||
})
|
||||
.word8('x')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
moo : { x : 1, y : 2, z : 3 },
|
||||
w : 4,
|
||||
x : 5,
|
||||
});
|
||||
})
|
||||
;
|
||||
});
|
43
app/node_modules/binary/test/into_stream.js
generated
vendored
Normal file
43
app/node_modules/binary/test/into_stream.js
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('into stream', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var digits = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var stream = new EventEmitter;
|
||||
var iv = setInterval(function () {
|
||||
var d = digits.shift();
|
||||
if (d) stream.emit('data', new Buffer([ d ]))
|
||||
else clearInterval(iv)
|
||||
}, 20);
|
||||
|
||||
binary.stream(stream)
|
||||
.into('moo', function () {
|
||||
this
|
||||
.word8('x')
|
||||
.word8('y')
|
||||
.word8('z')
|
||||
;
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { moo : { x : 1, y : 2, z : 3 } });
|
||||
})
|
||||
.word8('w')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
moo : { x : 1, y : 2, z : 3 },
|
||||
w : 4,
|
||||
});
|
||||
})
|
||||
.word8('x')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
moo : { x : 1, y : 2, z : 3 },
|
||||
w : 4,
|
||||
x : 5,
|
||||
});
|
||||
})
|
||||
;
|
||||
});
|
44
app/node_modules/binary/test/loop.js
generated
vendored
Normal file
44
app/node_modules/binary/test/loop.js
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('loop', function (t) {
|
||||
t.plan(3 * 2 + 1);
|
||||
|
||||
var em = new EventEmitter;
|
||||
|
||||
binary.stream(em)
|
||||
.loop(function (end, vars) {
|
||||
t.strictEqual(vars, this.vars);
|
||||
this
|
||||
.word16lu('a')
|
||||
.word8u('b')
|
||||
.word8s('c')
|
||||
.tap(function (vars_) {
|
||||
t.strictEqual(vars, vars_);
|
||||
if (vars.c < 0) end();
|
||||
})
|
||||
;
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { a : 1337, b : 55, c : -5 });
|
||||
})
|
||||
;
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 2, 10, 88 ]));
|
||||
}, 10);
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 100, 3, 6, 242, 30 ]));
|
||||
}, 20);
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 60, 60, 199, 44 ]));
|
||||
}, 30);
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 57, 5 ]));
|
||||
}, 80);
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 55, 251 ]));
|
||||
}, 90);
|
||||
});
|
54
app/node_modules/binary/test/loop_scan.js
generated
vendored
Normal file
54
app/node_modules/binary/test/loop_scan.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('loop scan', function (t) {
|
||||
t.plan(8 + 6 + 2);
|
||||
|
||||
var em = new EventEmitter;
|
||||
|
||||
binary.stream(em)
|
||||
.loop(function (end) {
|
||||
var vars_ = this.vars;
|
||||
this
|
||||
.scan('filler', 'BEGINMSG')
|
||||
.buffer('cmd', 3)
|
||||
.word8('num')
|
||||
.tap(function (vars) {
|
||||
t.strictEqual(vars, vars_);
|
||||
if (vars.num != 0x02 && vars.num != 0x06) {
|
||||
t.same(vars.filler.length, 0);
|
||||
}
|
||||
if (vars.cmd.toString() == 'end') end();
|
||||
})
|
||||
;
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.same(vars.cmd.toString(), 'end');
|
||||
t.same(vars.num, 0x08);
|
||||
})
|
||||
;
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer(
|
||||
'BEGINMSGcmd\x01'
|
||||
+ 'GARBAGEDATAXXXX'
|
||||
+ 'BEGINMSGcmd\x02'
|
||||
+ 'BEGINMSGcmd\x03'
|
||||
));
|
||||
}, 10);
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer(
|
||||
'BEGINMSGcmd\x04'
|
||||
+ 'BEGINMSGcmd\x05'
|
||||
+ 'GARBAGEDATAXXXX'
|
||||
+ 'BEGINMSGcmd\x06'
|
||||
));
|
||||
em.emit('data', new Buffer('BEGINMSGcmd\x07'));
|
||||
}, 20);
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer('BEGINMSGend\x08'));
|
||||
}, 30);
|
||||
});
|
46
app/node_modules/binary/test/lu.js
generated
vendored
Normal file
46
app/node_modules/binary/test/lu.js
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('lu', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
// note: can't store -12667700813876161 exactly in an ieee float
|
||||
|
||||
var buf = new Buffer([
|
||||
44, // a == 44
|
||||
43, 2, // b == 555
|
||||
37, 37, 213, 164, // c == 2765432101
|
||||
193, 203, 115, 155, 20, 180, 81, 29, // d == 2112667700813876161
|
||||
]);
|
||||
|
||||
binary.parse(buf)
|
||||
.word8lu('a')
|
||||
.word16lu('b')
|
||||
.word32lu('c')
|
||||
.word64lu('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 44);
|
||||
t.same(vars.b, 555);
|
||||
t.same(vars.c, 2765432101);
|
||||
t.ok(
|
||||
Math.abs(vars.d - 2112667700813876161) < 1500
|
||||
);
|
||||
})
|
||||
;
|
||||
|
||||
// also check aliases here:
|
||||
binary.parse(buf)
|
||||
.word8le('a')
|
||||
.word16le('b')
|
||||
.word32le('c')
|
||||
.word64le('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 44);
|
||||
t.same(vars.b, 555);
|
||||
t.same(vars.c, 2765432101);
|
||||
t.ok(
|
||||
Math.abs(vars.d - 2112667700813876161) < 1500
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
29
app/node_modules/binary/test/negbs.js
generated
vendored
Normal file
29
app/node_modules/binary/test/negbs.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('negbs', function (t) {
|
||||
t.plan(4);
|
||||
// note: can't store -12667700813876161 exactly in an ieee float
|
||||
|
||||
var buf = new Buffer([
|
||||
226, // a == -30
|
||||
246, 219, // b == -2341
|
||||
255, 243, 245, 236, // c == -789012
|
||||
255, 210, 254, 203, 16, 222, 52, 63, // d == -12667700813876161
|
||||
]);
|
||||
|
||||
binary.parse(buf)
|
||||
.word8bs('a')
|
||||
.word16bs('b')
|
||||
.word32bs('c')
|
||||
.word64bs('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, -30);
|
||||
t.same(vars.b, -2341);
|
||||
t.same(vars.c, -789012);
|
||||
t.ok(
|
||||
Math.abs(vars.d - -12667700813876161) < 1500
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
29
app/node_modules/binary/test/negls.js
generated
vendored
Normal file
29
app/node_modules/binary/test/negls.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('negls', function (t) {
|
||||
t.plan(4);
|
||||
// note: can't store -12667700813876161 exactly in an ieee float
|
||||
|
||||
var buf = new Buffer([
|
||||
226, // a == -30
|
||||
219, 246, // b == -2341
|
||||
236, 245, 243, 255, // c == -789012
|
||||
63, 52, 222, 16, 203, 254, 210, 255, // d == -12667700813876161
|
||||
]);
|
||||
|
||||
binary.parse(buf)
|
||||
.word8ls('a')
|
||||
.word16ls('b')
|
||||
.word32ls('c')
|
||||
.word64ls('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, -30);
|
||||
t.same(vars.b, -2341);
|
||||
t.same(vars.c, -789012);
|
||||
t.ok(
|
||||
Math.abs(vars.d - -12667700813876161) < 1000
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
35
app/node_modules/binary/test/nested.js
generated
vendored
Normal file
35
app/node_modules/binary/test/nested.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('nested', function (t) {
|
||||
t.plan(3);
|
||||
var insideDone = false;
|
||||
|
||||
var em = new EventEmitter;
|
||||
binary.stream(em)
|
||||
.word16be('ab')
|
||||
.tap(function () {
|
||||
this
|
||||
.word8('c')
|
||||
.word8('d')
|
||||
.tap(function () {
|
||||
insideDone = true;
|
||||
})
|
||||
;
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.ok(insideDone);
|
||||
t.same(vars.c, 'c'.charCodeAt(0));
|
||||
t.same(vars.d, 'd'.charCodeAt(0));
|
||||
|
||||
})
|
||||
;
|
||||
|
||||
var strs = [ 'abc', 'def', 'hi', 'jkl' ];
|
||||
var iv = setInterval(function () {
|
||||
var s = strs.shift();
|
||||
if (s) em.emit('data', new Buffer(s));
|
||||
else clearInterval(iv);
|
||||
}, 50);
|
||||
});
|
17
app/node_modules/binary/test/not_enough_buf.js
generated
vendored
Normal file
17
app/node_modules/binary/test/not_enough_buf.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('not enough buf', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var vars = binary(new Buffer([1,2,3,4]))
|
||||
.word8('a')
|
||||
.buffer('b', 10)
|
||||
.word8('c')
|
||||
.vars
|
||||
;
|
||||
|
||||
t.same(vars.a, 1);
|
||||
t.equal(vars.b.toString(), new Buffer([2,3,4]).toString());
|
||||
t.strictEqual(vars.c, null);
|
||||
});
|
19
app/node_modules/binary/test/not_enough_parse.js
generated
vendored
Normal file
19
app/node_modules/binary/test/not_enough_parse.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('not enough parse', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var vars = binary(new Buffer([1,2]))
|
||||
.word8('a')
|
||||
.word8('b')
|
||||
.word8('c')
|
||||
.word8('d')
|
||||
.vars
|
||||
;
|
||||
|
||||
t.same(vars.a, 1);
|
||||
t.same(vars.b, 2);
|
||||
t.strictEqual(vars.c, null);
|
||||
t.strictEqual(vars.d, null);
|
||||
});
|
54
app/node_modules/binary/test/parse.js
generated
vendored
Normal file
54
app/node_modules/binary/test/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('parse', function (t) {
|
||||
t.plan(6);
|
||||
var res = binary.parse(new Buffer([ 97, 98, 99, 99, 99, 99, 1, 2, 3 ]))
|
||||
.word8('a')
|
||||
.word16be('bc')
|
||||
.skip(3)
|
||||
.buffer('def', 3)
|
||||
.tap(function (vars) {
|
||||
t.equal(vars.a, 97);
|
||||
t.equal(vars.bc, 25187);
|
||||
t.same(
|
||||
[].slice.call(vars.def),
|
||||
[].slice.call(new Buffer([ 1, 2, 3]))
|
||||
);
|
||||
})
|
||||
.vars
|
||||
;
|
||||
t.equal(res.a, 97);
|
||||
t.equal(res.bc, 25187);
|
||||
t.same(
|
||||
[].slice.call(res.def),
|
||||
[].slice.call(new Buffer([ 1, 2, 3 ]))
|
||||
);
|
||||
});
|
||||
|
||||
test('loop', function (t) {
|
||||
t.plan(2);
|
||||
var res = binary.parse(new Buffer([ 97, 98, 99, 4, 5, 2, -3, 9 ]))
|
||||
.word8('a')
|
||||
.word16be('bc')
|
||||
.loop(function (end) {
|
||||
var x = this.word8s('x').vars.x;
|
||||
if (x < 0) end();
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
a : 97,
|
||||
bc : 25187,
|
||||
x : -3,
|
||||
});
|
||||
})
|
||||
.word8('y')
|
||||
.vars
|
||||
;
|
||||
t.same(res, {
|
||||
a : 97,
|
||||
bc : 25187,
|
||||
x : -3,
|
||||
y : 9,
|
||||
});
|
||||
});
|
40
app/node_modules/binary/test/peek.js
generated
vendored
Normal file
40
app/node_modules/binary/test/peek.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('peek', function (t) {
|
||||
t.plan(4);
|
||||
var bufs = [
|
||||
new Buffer([ 6, 1, 6, 1, 6, 9, 0, 0, 0, 97 ]),
|
||||
new Buffer([ 98, 99 ]),
|
||||
new Buffer([ 100, 101, 102 ]),
|
||||
];
|
||||
|
||||
var stream = new EventEmitter;
|
||||
var iv = setInterval(function () {
|
||||
var buf = bufs.shift();
|
||||
if (buf) stream.emit('data', buf)
|
||||
else clearInterval(iv)
|
||||
}, 20);
|
||||
|
||||
binary.stream(stream)
|
||||
.buffer('sixone', 5)
|
||||
.peek(function () {
|
||||
this.word32le('len');
|
||||
})
|
||||
.buffer('buf', 'len')
|
||||
.word8('x')
|
||||
.tap(function (vars) {
|
||||
t.same(
|
||||
[].slice.call(vars.sixone),
|
||||
[].slice.call(new Buffer([ 6, 1, 6, 1, 6 ]))
|
||||
);
|
||||
t.same(vars.buf.length, vars.len);
|
||||
t.same(
|
||||
[].slice.call(vars.buf),
|
||||
[ 9, 0, 0, 0, 97, 98, 99, 100, 101 ]
|
||||
);
|
||||
t.same(vars.x, 102);
|
||||
})
|
||||
;
|
||||
});
|
49
app/node_modules/binary/test/pipe.js
generated
vendored
Normal file
49
app/node_modules/binary/test/pipe.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var Stream = require('stream').Stream;
|
||||
|
||||
test('loop', function (t) {
|
||||
t.plan(3 * 2 + 1);
|
||||
|
||||
var rs = new Stream;
|
||||
rs.readable = true;
|
||||
|
||||
var ws = binary()
|
||||
.loop(function (end, vars) {
|
||||
t.strictEqual(vars, this.vars);
|
||||
this
|
||||
.word16lu('a')
|
||||
.word8u('b')
|
||||
.word8s('c')
|
||||
.tap(function (vars_) {
|
||||
t.strictEqual(vars, vars_);
|
||||
if (vars.c < 0) end();
|
||||
})
|
||||
;
|
||||
})
|
||||
.tap(function (vars) {
|
||||
t.same(vars, { a : 1337, b : 55, c : -5 });
|
||||
})
|
||||
;
|
||||
rs.pipe(ws);
|
||||
|
||||
setTimeout(function () {
|
||||
rs.emit('data', new Buffer([ 2, 10, 88 ]));
|
||||
}, 10);
|
||||
setTimeout(function () {
|
||||
rs.emit('data', new Buffer([ 100, 3, 6, 242, 30 ]));
|
||||
}, 20);
|
||||
setTimeout(function () {
|
||||
rs.emit('data', new Buffer([ 60, 60, 199, 44 ]));
|
||||
}, 30);
|
||||
|
||||
setTimeout(function () {
|
||||
rs.emit('data', new Buffer([ 57, 5 ]));
|
||||
}, 80);
|
||||
setTimeout(function () {
|
||||
rs.emit('data', new Buffer([ 55, 251 ]));
|
||||
}, 90);
|
||||
setTimeout(function () {
|
||||
rs.emit('end');
|
||||
}, 100);
|
||||
});
|
29
app/node_modules/binary/test/posbs.js
generated
vendored
Normal file
29
app/node_modules/binary/test/posbs.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('posbs', function (t) {
|
||||
t.plan(4);
|
||||
// note: can't store 12667700813876161 exactly in an ieee float
|
||||
|
||||
var buf = new Buffer([
|
||||
30, // a == -30
|
||||
9, 37, // b == -2341
|
||||
0, 12, 10, 20, // c == -789012
|
||||
0, 45, 1, 52, 239, 33, 203, 193, // d == 12667700813876161
|
||||
]);
|
||||
|
||||
binary.parse(buf)
|
||||
.word8bs('a')
|
||||
.word16bs('b')
|
||||
.word32bs('c')
|
||||
.word64bs('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 30);
|
||||
t.same(vars.b, 2341);
|
||||
t.same(vars.c, 789012);
|
||||
t.ok(
|
||||
Math.abs(vars.d - 12667700813876161) < 1000
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
29
app/node_modules/binary/test/posls.js
generated
vendored
Normal file
29
app/node_modules/binary/test/posls.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('posls', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
// note: can't store 12667700813876161 exactly in an ieee float
|
||||
var buf = new Buffer([
|
||||
30, // a == -30
|
||||
37, 9, // b == -2341
|
||||
20, 10, 12, 0, // c == -789012
|
||||
193, 203, 33, 239, 52, 1, 45, 0, // d == 12667700813876161
|
||||
]);
|
||||
|
||||
binary.parse(buf)
|
||||
.word8ls('a')
|
||||
.word16ls('b')
|
||||
.word32ls('c')
|
||||
.word64ls('d')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 30);
|
||||
t.same(vars.b, 2341);
|
||||
t.same(vars.c, 789012);
|
||||
t.ok(
|
||||
Math.abs(vars.d - 12667700813876161) < 1000
|
||||
);
|
||||
})
|
||||
;
|
||||
});
|
33
app/node_modules/binary/test/scan.js
generated
vendored
Normal file
33
app/node_modules/binary/test/scan.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('scan', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var em = new EventEmitter;
|
||||
binary(em)
|
||||
.word8('a')
|
||||
.scan('l1', new Buffer('\r\n'))
|
||||
.scan('l2', '\r\n')
|
||||
.word8('z')
|
||||
.tap(function (vars) {
|
||||
t.same(vars.a, 99);
|
||||
t.same(vars.l1.toString(), 'foo bar');
|
||||
t.same(vars.l2.toString(), 'baz');
|
||||
t.same(vars.z, 42);
|
||||
})
|
||||
;
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([99,0x66,0x6f,0x6f,0x20]));
|
||||
}, 20);
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer('bar\r'));
|
||||
}, 40);
|
||||
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer('\nbaz\r\n*'));
|
||||
}, 60);
|
||||
});
|
18
app/node_modules/binary/test/scan_buf.js
generated
vendored
Normal file
18
app/node_modules/binary/test/scan_buf.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('scan buf', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var vars = binary(new Buffer('\x63foo bar\r\nbaz\r\n*'))
|
||||
.word8('a')
|
||||
.scan('l1', new Buffer('\r\n'))
|
||||
.scan('l2', '\r\n')
|
||||
.word8('z')
|
||||
.vars
|
||||
;
|
||||
t.same(vars.a, 99);
|
||||
t.same(vars.z, 42);
|
||||
t.same(vars.l1.toString(), 'foo bar');
|
||||
t.same(vars.l2.toString(), 'baz');
|
||||
});
|
16
app/node_modules/binary/test/scan_buf_null.js
generated
vendored
Normal file
16
app/node_modules/binary/test/scan_buf_null.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
|
||||
test('scan buf null', function (t) {
|
||||
t.plan(3);
|
||||
var vars = binary(new Buffer('\x63foo bar baz'))
|
||||
.word8('a')
|
||||
.scan('b', '\r\n')
|
||||
.word8('c')
|
||||
.vars
|
||||
;
|
||||
|
||||
t.same(vars.a, 99);
|
||||
t.same(vars.b.toString(), 'foo bar baz');
|
||||
t.strictEqual(vars.c, null);
|
||||
});
|
58
app/node_modules/binary/test/skip.js
generated
vendored
Normal file
58
app/node_modules/binary/test/skip.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var seq = require('seq');
|
||||
|
||||
test('skip', function (t) {
|
||||
t.plan(7);
|
||||
var em = new EventEmitter;
|
||||
var state = 0;
|
||||
|
||||
binary(em)
|
||||
.word16lu('a')
|
||||
.tap(function () { state = 1 })
|
||||
.skip(7)
|
||||
.tap(function () { state = 2 })
|
||||
.word8('b')
|
||||
.tap(function () { state = 3 })
|
||||
.tap(function (vars) {
|
||||
t.same(state, 3);
|
||||
t.same(vars, {
|
||||
a : 2569,
|
||||
b : 8,
|
||||
});
|
||||
})
|
||||
;
|
||||
|
||||
seq()
|
||||
.seq(setTimeout, seq, 20)
|
||||
.seq(function () {
|
||||
t.same(state, 0);
|
||||
em.emit('data', new Buffer([ 9 ]));
|
||||
this(null);
|
||||
})
|
||||
.seq(setTimeout, seq, 5)
|
||||
.seq(function () {
|
||||
t.same(state, 0);
|
||||
em.emit('data', new Buffer([ 10, 1, 2 ]));
|
||||
this(null);
|
||||
})
|
||||
.seq(setTimeout, seq, 30)
|
||||
.seq(function () {
|
||||
t.same(state, 1);
|
||||
em.emit('data', new Buffer([ 3, 4, 5 ]));
|
||||
this(null);
|
||||
})
|
||||
.seq(setTimeout, seq, 15)
|
||||
.seq(function () {
|
||||
t.same(state, 1);
|
||||
em.emit('data', new Buffer([ 6, 7 ]));
|
||||
this(null);
|
||||
})
|
||||
.seq(function () {
|
||||
t.same(state, 2);
|
||||
em.emit('data', new Buffer([ 8 ]));
|
||||
this(null);
|
||||
})
|
||||
;
|
||||
});
|
34
app/node_modules/binary/test/split.js
generated
vendored
Normal file
34
app/node_modules/binary/test/split.js
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
var binary = require('../');
|
||||
var test = require('tap').test;
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
test('split', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var em = new EventEmitter;
|
||||
binary.stream(em)
|
||||
.word8('a')
|
||||
.word16be('bc')
|
||||
.word32ls('x')
|
||||
.word32bs('y')
|
||||
.tap(function (vars) {
|
||||
t.same(vars, {
|
||||
a : 97,
|
||||
bc : 25187,
|
||||
x : 621609828,
|
||||
y : 621609828,
|
||||
});
|
||||
})
|
||||
;
|
||||
|
||||
em.emit('data', new Buffer([ 97, 98 ]));
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 99, 100 ]));
|
||||
}, 25);
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 3, 13, 37, 37 ]));
|
||||
}, 30);
|
||||
setTimeout(function () {
|
||||
em.emit('data', new Buffer([ 13, 3, 100 ]));
|
||||
}, 40);
|
||||
});
|
21
app/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
21
app/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
129
app/node_modules/brace-expansion/README.md
generated
vendored
Normal file
129
app/node_modules/brace-expansion/README.md
generated
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
# brace-expansion
|
||||
|
||||
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||
as known from sh/bash, in JavaScript.
|
||||
|
||||
[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
|
||||
[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
|
||||
[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)
|
||||
|
||||
[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
|
||||
expand('file-{a,b,c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('-v{,,}')
|
||||
// => ['-v', '-v', '-v']
|
||||
|
||||
expand('file{0..2}.jpg')
|
||||
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||
|
||||
expand('file-{a..c}.jpg')
|
||||
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||
|
||||
expand('file{2..0}.jpg')
|
||||
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||
|
||||
expand('file{0..4..2}.jpg')
|
||||
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||
|
||||
expand('file-{a..e..2}.jpg')
|
||||
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||
|
||||
expand('file{00..10..5}.jpg')
|
||||
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||
|
||||
expand('{{A..C},{a..c}}')
|
||||
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||
|
||||
expand('ppp{,config,oe{,conf}}')
|
||||
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var expand = require('brace-expansion');
|
||||
```
|
||||
|
||||
### var expanded = expand(str)
|
||||
|
||||
Return an array of all possible and valid expansions of `str`. If none are
|
||||
found, `[str]` is returned.
|
||||
|
||||
Valid expansions are:
|
||||
|
||||
```js
|
||||
/^(.*,)+(.+)?$/
|
||||
// {a,b,...}
|
||||
```
|
||||
|
||||
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||
to have equal length. Negative numbers and backwards iteration work too.
|
||||
|
||||
```js
|
||||
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||
// {x..y[..incr]}
|
||||
```
|
||||
|
||||
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||
number.
|
||||
|
||||
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```bash
|
||||
npm install brace-expansion
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
- [Julian Gruber](https://github.com/juliangruber)
|
||||
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||
|
||||
## Sponsors
|
||||
|
||||
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||
|
||||
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
201
app/node_modules/brace-expansion/index.js
generated
vendored
Normal file
201
app/node_modules/brace-expansion/index.js
generated
vendored
Normal file
|
@ -0,0 +1,201 @@
|
|||
var concatMap = require('concat-map');
|
||||
var balanced = require('balanced-match');
|
||||
|
||||
module.exports = expandTop;
|
||||
|
||||
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||
|
||||
function numeric(str) {
|
||||
return parseInt(str, 10) == str
|
||||
? parseInt(str, 10)
|
||||
: str.charCodeAt(0);
|
||||
}
|
||||
|
||||
function escapeBraces(str) {
|
||||
return str.split('\\\\').join(escSlash)
|
||||
.split('\\{').join(escOpen)
|
||||
.split('\\}').join(escClose)
|
||||
.split('\\,').join(escComma)
|
||||
.split('\\.').join(escPeriod);
|
||||
}
|
||||
|
||||
function unescapeBraces(str) {
|
||||
return str.split(escSlash).join('\\')
|
||||
.split(escOpen).join('{')
|
||||
.split(escClose).join('}')
|
||||
.split(escComma).join(',')
|
||||
.split(escPeriod).join('.');
|
||||
}
|
||||
|
||||
|
||||
// Basically just str.split(","), but handling cases
|
||||
// where we have nested braced sections, which should be
|
||||
// treated as individual members, like {a,{b,c},d}
|
||||
function parseCommaParts(str) {
|
||||
if (!str)
|
||||
return [''];
|
||||
|
||||
var parts = [];
|
||||
var m = balanced('{', '}', str);
|
||||
|
||||
if (!m)
|
||||
return str.split(',');
|
||||
|
||||
var pre = m.pre;
|
||||
var body = m.body;
|
||||
var post = m.post;
|
||||
var p = pre.split(',');
|
||||
|
||||
p[p.length-1] += '{' + body + '}';
|
||||
var postParts = parseCommaParts(post);
|
||||
if (post.length) {
|
||||
p[p.length-1] += postParts.shift();
|
||||
p.push.apply(p, postParts);
|
||||
}
|
||||
|
||||
parts.push.apply(parts, p);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function expandTop(str) {
|
||||
if (!str)
|
||||
return [];
|
||||
|
||||
// I don't know why Bash 4.3 does this, but it does.
|
||||
// Anything starting with {} will have the first two bytes preserved
|
||||
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||
// but a{},b}c will be expanded to [a}c,abc].
|
||||
// One could argue that this is a bug in Bash, but since the goal of
|
||||
// this module is to match Bash's rules, we escape a leading {}
|
||||
if (str.substr(0, 2) === '{}') {
|
||||
str = '\\{\\}' + str.substr(2);
|
||||
}
|
||||
|
||||
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||
}
|
||||
|
||||
function identity(e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
function embrace(str) {
|
||||
return '{' + str + '}';
|
||||
}
|
||||
function isPadded(el) {
|
||||
return /^-?0\d/.test(el);
|
||||
}
|
||||
|
||||
function lte(i, y) {
|
||||
return i <= y;
|
||||
}
|
||||
function gte(i, y) {
|
||||
return i >= y;
|
||||
}
|
||||
|
||||
function expand(str, isTop) {
|
||||
var expansions = [];
|
||||
|
||||
var m = balanced('{', '}', str);
|
||||
if (!m || /\$$/.test(m.pre)) return [str];
|
||||
|
||||
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||
var isSequence = isNumericSequence || isAlphaSequence;
|
||||
var isOptions = m.body.indexOf(',') >= 0;
|
||||
if (!isSequence && !isOptions) {
|
||||
// {a},b}
|
||||
if (m.post.match(/,.*\}/)) {
|
||||
str = m.pre + '{' + m.body + escClose + m.post;
|
||||
return expand(str);
|
||||
}
|
||||
return [str];
|
||||
}
|
||||
|
||||
var n;
|
||||
if (isSequence) {
|
||||
n = m.body.split(/\.\./);
|
||||
} else {
|
||||
n = parseCommaParts(m.body);
|
||||
if (n.length === 1) {
|
||||
// x{{a,b}}y ==> x{a}y x{b}y
|
||||
n = expand(n[0], false).map(embrace);
|
||||
if (n.length === 1) {
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
return post.map(function(p) {
|
||||
return m.pre + n[0] + p;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// at this point, n is the parts, and we know it's not a comma set
|
||||
// with a single entry.
|
||||
|
||||
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||
var pre = m.pre;
|
||||
var post = m.post.length
|
||||
? expand(m.post, false)
|
||||
: [''];
|
||||
|
||||
var N;
|
||||
|
||||
if (isSequence) {
|
||||
var x = numeric(n[0]);
|
||||
var y = numeric(n[1]);
|
||||
var width = Math.max(n[0].length, n[1].length)
|
||||
var incr = n.length == 3
|
||||
? Math.abs(numeric(n[2]))
|
||||
: 1;
|
||||
var test = lte;
|
||||
var reverse = y < x;
|
||||
if (reverse) {
|
||||
incr *= -1;
|
||||
test = gte;
|
||||
}
|
||||
var pad = n.some(isPadded);
|
||||
|
||||
N = [];
|
||||
|
||||
for (var i = x; test(i, y); i += incr) {
|
||||
var c;
|
||||
if (isAlphaSequence) {
|
||||
c = String.fromCharCode(i);
|
||||
if (c === '\\')
|
||||
c = '';
|
||||
} else {
|
||||
c = String(i);
|
||||
if (pad) {
|
||||
var need = width - c.length;
|
||||
if (need > 0) {
|
||||
var z = new Array(need + 1).join('0');
|
||||
if (i < 0)
|
||||
c = '-' + z + c.slice(1);
|
||||
else
|
||||
c = z + c;
|
||||
}
|
||||
}
|
||||
}
|
||||
N.push(c);
|
||||
}
|
||||
} else {
|
||||
N = concatMap(n, function(el) { return expand(el, false) });
|
||||
}
|
||||
|
||||
for (var j = 0; j < N.length; j++) {
|
||||
for (var k = 0; k < post.length; k++) {
|
||||
var expansion = pre + N[j] + post[k];
|
||||
if (!isTop || isSequence || expansion)
|
||||
expansions.push(expansion);
|
||||
}
|
||||
}
|
||||
|
||||
return expansions;
|
||||
}
|
||||
|
117
app/node_modules/brace-expansion/package.json
generated
vendored
Normal file
117
app/node_modules/brace-expansion/package.json
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "brace-expansion@^1.1.7",
|
||||
"scope": null,
|
||||
"escapedName": "brace-expansion",
|
||||
"name": "brace-expansion",
|
||||
"rawSpec": "^1.1.7",
|
||||
"spec": ">=1.1.7 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\minimatch"
|
||||
]
|
||||
],
|
||||
"_from": "brace-expansion@>=1.1.7 <2.0.0",
|
||||
"_id": "brace-expansion@1.1.11",
|
||||
"_inCache": true,
|
||||
"_location": "/brace-expansion",
|
||||
"_nodeVersion": "9.0.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "s3://npm-registry-packages",
|
||||
"tmp": "tmp/brace-expansion_1.1.11_1518248541320_0.33962849281003904"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
},
|
||||
"_npmVersion": "5.5.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "brace-expansion@^1.1.7",
|
||||
"scope": null,
|
||||
"escapedName": "brace-expansion",
|
||||
"name": "brace-expansion",
|
||||
"rawSpec": "^1.1.7",
|
||||
"spec": ">=1.1.7 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/minimatch"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "brace-expansion@^1.1.7",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\minimatch",
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
},
|
||||
"description": "Brace expansion as known from sh/bash",
|
||||
"devDependencies": {
|
||||
"matcha": "^0.7.0",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
|
||||
"tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"fileCount": 4,
|
||||
"unpackedSize": 11059
|
||||
},
|
||||
"gitHead": "01a21de7441549d26ac0c0a9ff91385d16e5c21c",
|
||||
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "isaacs@npmjs.com"
|
||||
},
|
||||
{
|
||||
"name": "juliangruber",
|
||||
"email": "julian@juliangruber.com"
|
||||
}
|
||||
],
|
||||
"name": "brace-expansion",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha test/perf/bench.js",
|
||||
"gentest": "bash test/generate.sh",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/20..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/25..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"version": "1.1.11"
|
||||
}
|
122
app/node_modules/buffers/README.markdown
generated
vendored
Normal file
122
app/node_modules/buffers/README.markdown
generated
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
buffers
|
||||
=======
|
||||
|
||||
Treat a collection of Buffers as a single contiguous partially mutable Buffer.
|
||||
|
||||
Where possible, operations execute without creating a new Buffer and copying
|
||||
everything over.
|
||||
|
||||
This is a cleaner more Buffery rehash of
|
||||
[bufferlist](http://github.com/substack/node-bufferlist).
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
slice
|
||||
-----
|
||||
|
||||
var Buffers = require('buffers');
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer([1,2,3]));
|
||||
bufs.push(new Buffer([4,5,6,7]));
|
||||
bufs.push(new Buffer([8,9,10]));
|
||||
|
||||
console.dir(bufs.slice(2,8))
|
||||
|
||||
output:
|
||||
|
||||
$ node examples/slice.js
|
||||
<Buffer 03 04 05 06 07 08>
|
||||
|
||||
splice
|
||||
------
|
||||
|
||||
var Buffers = require('buffers');
|
||||
var bufs = Buffers([
|
||||
new Buffer([1,2,3]),
|
||||
new Buffer([4,5,6,7]),
|
||||
new Buffer([8,9,10]),
|
||||
]);
|
||||
|
||||
var removed = bufs.splice(2, 4);
|
||||
console.dir({
|
||||
removed : removed.slice(),
|
||||
bufs : bufs.slice(),
|
||||
});
|
||||
|
||||
output:
|
||||
|
||||
$ node examples/splice.js
|
||||
{ removed: <Buffer 03 04 05 06>,
|
||||
bufs: <Buffer 01 02 07 08 09 0a> }
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
Buffers(buffers)
|
||||
----------------
|
||||
|
||||
Create a Buffers with an array of `Buffer`s if specified, else `[]`.
|
||||
|
||||
.push(buf1, buf2...)
|
||||
--------------------
|
||||
|
||||
Push buffers onto the end. Just like `Array.prototype.push`.
|
||||
|
||||
.unshift(buf1, buf2...)
|
||||
-----------------------
|
||||
|
||||
Unshift buffers onto the head. Just like `Array.prototype.unshift`.
|
||||
|
||||
.slice(i, j)
|
||||
------------
|
||||
|
||||
Slice a range out of the buffer collection as if it were contiguous.
|
||||
Works just like the `Array.prototype.slice` version.
|
||||
|
||||
.splice(i, howMany, replacements)
|
||||
---------------------------------
|
||||
|
||||
Splice the buffer collection as if it were contiguous.
|
||||
Works just like `Array.prototype.splice`, even the replacement part!
|
||||
|
||||
.copy(dst, dstStart, start, end)
|
||||
--------------------------------
|
||||
|
||||
Copy the buffer collection as if it were contiguous to the `dst` Buffer with the
|
||||
specified bounds.
|
||||
Works just like `Buffer.prototype.copy`.
|
||||
|
||||
.get(i)
|
||||
-------
|
||||
|
||||
Get a single element at index `i`.
|
||||
|
||||
.set(i, x)
|
||||
----------
|
||||
|
||||
Set a single element's value at index `i`.
|
||||
|
||||
.indexOf(needle, offset)
|
||||
----------
|
||||
|
||||
Find a string or buffer `needle` inside the buffer collection. Returns
|
||||
the position of the search string or -1 if the search string was not
|
||||
found.
|
||||
|
||||
Provide an `offset` to skip that number of characters at the beginning
|
||||
of the search. This can be used to find additional matches.
|
||||
|
||||
This function will return the correct result even if the search string
|
||||
is spread out over multiple internal buffers.
|
||||
|
||||
.toBuffer()
|
||||
-----------
|
||||
|
||||
Convert the buffer collection to a single buffer, equivalent with `.slice(0, buffers.length)`;
|
||||
|
||||
.toString(encoding, start, end)
|
||||
-----------
|
||||
|
||||
Decodes and returns a string from the buffer collection.
|
||||
Works just like `Buffer.prototype.toString`
|
9
app/node_modules/buffers/examples/slice.js
generated
vendored
Normal file
9
app/node_modules/buffers/examples/slice.js
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
var Buffers = require('buffers');
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer([1,2,3]));
|
||||
bufs.push(new Buffer([4,5,6,7]));
|
||||
bufs.push(new Buffer([8,9,10]));
|
||||
|
||||
console.dir(bufs.slice(2,8))
|
||||
|
||||
// Output: <Buffer 03 04 05 06 07 08>
|
17
app/node_modules/buffers/examples/splice.js
generated
vendored
Normal file
17
app/node_modules/buffers/examples/splice.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
var Buffers = require('buffers');
|
||||
var bufs = Buffers([
|
||||
new Buffer([1,2,3]),
|
||||
new Buffer([4,5,6,7]),
|
||||
new Buffer([8,9,10]),
|
||||
]);
|
||||
|
||||
var removed = bufs.splice(2, 4, new Buffer('ab'), new Buffer('cd'));
|
||||
console.dir({
|
||||
removed : removed.slice(),
|
||||
bufs : bufs.slice(),
|
||||
});
|
||||
|
||||
/* Output:
|
||||
{ removed: <Buffer 03 04 05 06>,
|
||||
bufs: <Buffer 01 02 07 08 09 0a> }
|
||||
*/
|
269
app/node_modules/buffers/index.js
generated
vendored
Normal file
269
app/node_modules/buffers/index.js
generated
vendored
Normal file
|
@ -0,0 +1,269 @@
|
|||
module.exports = Buffers;
|
||||
|
||||
function Buffers (bufs) {
|
||||
if (!(this instanceof Buffers)) return new Buffers(bufs);
|
||||
this.buffers = bufs || [];
|
||||
this.length = this.buffers.reduce(function (size, buf) {
|
||||
return size + buf.length
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Buffers.prototype.push = function () {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (!Buffer.isBuffer(arguments[i])) {
|
||||
throw new TypeError('Tried to push a non-buffer');
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var buf = arguments[i];
|
||||
this.buffers.push(buf);
|
||||
this.length += buf.length;
|
||||
}
|
||||
return this.length;
|
||||
};
|
||||
|
||||
Buffers.prototype.unshift = function () {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (!Buffer.isBuffer(arguments[i])) {
|
||||
throw new TypeError('Tried to unshift a non-buffer');
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var buf = arguments[i];
|
||||
this.buffers.unshift(buf);
|
||||
this.length += buf.length;
|
||||
}
|
||||
return this.length;
|
||||
};
|
||||
|
||||
Buffers.prototype.copy = function (dst, dStart, start, end) {
|
||||
return this.slice(start, end).copy(dst, dStart, 0, end - start);
|
||||
};
|
||||
|
||||
Buffers.prototype.splice = function (i, howMany) {
|
||||
var buffers = this.buffers;
|
||||
var index = i >= 0 ? i : this.length - i;
|
||||
var reps = [].slice.call(arguments, 2);
|
||||
|
||||
if (howMany === undefined) {
|
||||
howMany = this.length - index;
|
||||
}
|
||||
else if (howMany > this.length - index) {
|
||||
howMany = this.length - index;
|
||||
}
|
||||
|
||||
for (var i = 0; i < reps.length; i++) {
|
||||
this.length += reps[i].length;
|
||||
}
|
||||
|
||||
var removed = new Buffers();
|
||||
var bytes = 0;
|
||||
|
||||
var startBytes = 0;
|
||||
for (
|
||||
var ii = 0;
|
||||
ii < buffers.length && startBytes + buffers[ii].length < index;
|
||||
ii ++
|
||||
) { startBytes += buffers[ii].length }
|
||||
|
||||
if (index - startBytes > 0) {
|
||||
var start = index - startBytes;
|
||||
|
||||
if (start + howMany < buffers[ii].length) {
|
||||
removed.push(buffers[ii].slice(start, start + howMany));
|
||||
|
||||
var orig = buffers[ii];
|
||||
//var buf = new Buffer(orig.length - howMany);
|
||||
var buf0 = new Buffer(start);
|
||||
for (var i = 0; i < start; i++) {
|
||||
buf0[i] = orig[i];
|
||||
}
|
||||
|
||||
var buf1 = new Buffer(orig.length - start - howMany);
|
||||
for (var i = start + howMany; i < orig.length; i++) {
|
||||
buf1[ i - howMany - start ] = orig[i]
|
||||
}
|
||||
|
||||
if (reps.length > 0) {
|
||||
var reps_ = reps.slice();
|
||||
reps_.unshift(buf0);
|
||||
reps_.push(buf1);
|
||||
buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
|
||||
ii += reps_.length;
|
||||
reps = [];
|
||||
}
|
||||
else {
|
||||
buffers.splice(ii, 1, buf0, buf1);
|
||||
//buffers[ii] = buf;
|
||||
ii += 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
removed.push(buffers[ii].slice(start));
|
||||
buffers[ii] = buffers[ii].slice(0, start);
|
||||
ii ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (reps.length > 0) {
|
||||
buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
|
||||
ii += reps.length;
|
||||
}
|
||||
|
||||
while (removed.length < howMany) {
|
||||
var buf = buffers[ii];
|
||||
var len = buf.length;
|
||||
var take = Math.min(len, howMany - removed.length);
|
||||
|
||||
if (take === len) {
|
||||
removed.push(buf);
|
||||
buffers.splice(ii, 1);
|
||||
}
|
||||
else {
|
||||
removed.push(buf.slice(0, take));
|
||||
buffers[ii] = buffers[ii].slice(take);
|
||||
}
|
||||
}
|
||||
|
||||
this.length -= removed.length;
|
||||
|
||||
return removed;
|
||||
};
|
||||
|
||||
Buffers.prototype.slice = function (i, j) {
|
||||
var buffers = this.buffers;
|
||||
if (j === undefined) j = this.length;
|
||||
if (i === undefined) i = 0;
|
||||
|
||||
if (j > this.length) j = this.length;
|
||||
|
||||
var startBytes = 0;
|
||||
for (
|
||||
var si = 0;
|
||||
si < buffers.length && startBytes + buffers[si].length <= i;
|
||||
si ++
|
||||
) { startBytes += buffers[si].length }
|
||||
|
||||
var target = new Buffer(j - i);
|
||||
|
||||
var ti = 0;
|
||||
for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
|
||||
var len = buffers[ii].length;
|
||||
|
||||
var start = ti === 0 ? i - startBytes : 0;
|
||||
var end = ti + len >= j - i
|
||||
? Math.min(start + (j - i) - ti, len)
|
||||
: len
|
||||
;
|
||||
|
||||
buffers[ii].copy(target, ti, start, end);
|
||||
ti += end - start;
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
Buffers.prototype.pos = function (i) {
|
||||
if (i < 0 || i >= this.length) throw new Error('oob');
|
||||
var l = i, bi = 0, bu = null;
|
||||
for (;;) {
|
||||
bu = this.buffers[bi];
|
||||
if (l < bu.length) {
|
||||
return {buf: bi, offset: l};
|
||||
} else {
|
||||
l -= bu.length;
|
||||
}
|
||||
bi++;
|
||||
}
|
||||
};
|
||||
|
||||
Buffers.prototype.get = function get (i) {
|
||||
var pos = this.pos(i);
|
||||
|
||||
return this.buffers[pos.buf].get(pos.offset);
|
||||
};
|
||||
|
||||
Buffers.prototype.set = function set (i, b) {
|
||||
var pos = this.pos(i);
|
||||
|
||||
return this.buffers[pos.buf].set(pos.offset, b);
|
||||
};
|
||||
|
||||
Buffers.prototype.indexOf = function (needle, offset) {
|
||||
if ("string" === typeof needle) {
|
||||
needle = new Buffer(needle);
|
||||
} else if (needle instanceof Buffer) {
|
||||
// already a buffer
|
||||
} else {
|
||||
throw new Error('Invalid type for a search string');
|
||||
}
|
||||
|
||||
if (!needle.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!this.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var i = 0, j = 0, match = 0, mstart, pos = 0;
|
||||
|
||||
// start search from a particular point in the virtual buffer
|
||||
if (offset) {
|
||||
var p = this.pos(offset);
|
||||
i = p.buf;
|
||||
j = p.offset;
|
||||
pos = offset;
|
||||
}
|
||||
|
||||
// for each character in virtual buffer
|
||||
for (;;) {
|
||||
while (j >= this.buffers[i].length) {
|
||||
j = 0;
|
||||
i++;
|
||||
|
||||
if (i >= this.buffers.length) {
|
||||
// search string not found
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
var char = this.buffers[i][j];
|
||||
|
||||
if (char == needle[match]) {
|
||||
// keep track where match started
|
||||
if (match == 0) {
|
||||
mstart = {
|
||||
i: i,
|
||||
j: j,
|
||||
pos: pos
|
||||
};
|
||||
}
|
||||
match++;
|
||||
if (match == needle.length) {
|
||||
// full match
|
||||
return mstart.pos;
|
||||
}
|
||||
} else if (match != 0) {
|
||||
// a partial match ended, go back to match starting position
|
||||
// this will continue the search at the next character
|
||||
i = mstart.i;
|
||||
j = mstart.j;
|
||||
pos = mstart.pos;
|
||||
match = 0;
|
||||
}
|
||||
|
||||
j++;
|
||||
pos++;
|
||||
}
|
||||
};
|
||||
|
||||
Buffers.prototype.toBuffer = function() {
|
||||
return this.slice();
|
||||
}
|
||||
|
||||
Buffers.prototype.toString = function(encoding, start, end) {
|
||||
return this.slice(start, end).toString(encoding);
|
||||
}
|
87
app/node_modules/buffers/package.json
generated
vendored
Normal file
87
app/node_modules/buffers/package.json
generated
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "buffers@~0.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "buffers",
|
||||
"name": "buffers",
|
||||
"rawSpec": "~0.1.1",
|
||||
"spec": ">=0.1.1 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\binary"
|
||||
]
|
||||
],
|
||||
"_defaultsLoaded": true,
|
||||
"_engineSupported": true,
|
||||
"_from": "buffers@>=0.1.1 <0.2.0",
|
||||
"_id": "buffers@0.1.1",
|
||||
"_inCache": true,
|
||||
"_location": "/buffers",
|
||||
"_nodeVersion": "v0.4.12",
|
||||
"_npmJsonOpts": {
|
||||
"file": "/home/substack/.npm/buffers/0.1.1/package/package.json",
|
||||
"wscript": false,
|
||||
"contributors": false,
|
||||
"serverjs": false
|
||||
},
|
||||
"_npmVersion": "1.0.30",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "buffers@~0.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "buffers",
|
||||
"name": "buffers",
|
||||
"rawSpec": "~0.1.1",
|
||||
"spec": ">=0.1.1 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/binary",
|
||||
"/match-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
|
||||
"_shasum": "b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "buffers@~0.1.1",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\binary",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-buffers/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Treat a collection of Buffers as a single contiguous partially mutable Buffer.",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb",
|
||||
"tarball": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.2.0"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-buffers#readme",
|
||||
"main": "./index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
}
|
||||
],
|
||||
"name": "buffers",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/node-buffers.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "expresso"
|
||||
},
|
||||
"version": "0.1.1"
|
||||
}
|
209
app/node_modules/buffers/test/buffers.js
generated
vendored
Normal file
209
app/node_modules/buffers/test/buffers.js
generated
vendored
Normal file
|
@ -0,0 +1,209 @@
|
|||
var assert = require('assert');
|
||||
var Buffers = require('../');
|
||||
|
||||
function create (xs, split) {
|
||||
var bufs = Buffers();
|
||||
var offset = 0;
|
||||
split.forEach(function (i) {
|
||||
bufs.push(new Buffer(xs.slice(offset, offset + i)));
|
||||
offset += i;
|
||||
});
|
||||
return bufs;
|
||||
}
|
||||
|
||||
exports.slice = function () {
|
||||
var xs = [0,1,2,3,4,5,6,7,8,9];
|
||||
var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
|
||||
|
||||
splits.forEach(function (split) {
|
||||
var bufs = create(xs, split);
|
||||
assert.eql(new Buffer(xs), bufs.slice(),
|
||||
'[' + xs.join(',') + ']'
|
||||
+ ' != ' +
|
||||
'[' + [].join.call(bufs.slice(), ',') + ']'
|
||||
);
|
||||
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
for (var j = i; j < xs.length; j++) {
|
||||
var a = bufs.slice(i,j);
|
||||
var b = new Buffer(xs.slice(i,j));
|
||||
|
||||
assert.eql(a, b,
|
||||
'[' + [].join.call(a, ',') + ']'
|
||||
+ ' != ' +
|
||||
'[' + [].join.call(b, ',') + ']'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.splice = function () {
|
||||
var xs = [0,1,2,3,4,5,6,7,8,9];
|
||||
var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
|
||||
|
||||
splits.forEach(function (split) {
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
for (var j = i; j < xs.length; j++) {
|
||||
var bufs = create(xs, split);
|
||||
var xs_ = xs.slice();
|
||||
|
||||
var a_ = bufs.splice(i,j);
|
||||
var a = [].slice.call(a_.slice());
|
||||
var b = xs_.splice(i,j);
|
||||
assert.eql(a, b,
|
||||
'[' + a.join(',') + ']'
|
||||
+ ' != ' +
|
||||
'[' + b.join(',') + ']'
|
||||
);
|
||||
|
||||
assert.eql(bufs.slice(), new Buffer(xs_),
|
||||
'[' + [].join.call(bufs.slice(), ',') + ']'
|
||||
+ ' != ' +
|
||||
'[' + [].join.call(xs_, ',') + ']'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.spliceRep = function () {
|
||||
var xs = [0,1,2,3,4,5,6,7,8,9];
|
||||
var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
|
||||
var reps = [ [], [1], [5,6], [3,1,3,3,7], [9,8,7,6,5,4,3,2,1,2,3,4,5] ];
|
||||
|
||||
splits.forEach(function (split) {
|
||||
reps.forEach(function (rep) {
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
for (var j = i; j < xs.length; j++) {
|
||||
var bufs = create(xs, split);
|
||||
var xs_ = xs.slice();
|
||||
|
||||
var a_ = bufs.splice.apply(
|
||||
bufs, [ i, j ].concat(new Buffer(rep))
|
||||
);
|
||||
var a = [].slice.call(a_.slice());
|
||||
var b = xs_.splice.apply(xs_, [ i, j ].concat(rep));
|
||||
|
||||
assert.eql(a, b,
|
||||
'[' + a.join(',') + ']'
|
||||
+ ' != ' +
|
||||
'[' + b.join(',') + ']'
|
||||
);
|
||||
|
||||
assert.eql(bufs.slice(), new Buffer(xs_),
|
||||
'[' + [].join.call(bufs.slice(), ',') + ']'
|
||||
+ ' != ' +
|
||||
'[' + [].join.call(xs_, ',') + ']'
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.copy = function () {
|
||||
var xs = [0,1,2,3,4,5,6,7,8,9];
|
||||
var splits = [ [4,2,3,1], [2,2,2,2,2], [1,6,3,1], [9,2], [10], [5,5] ];
|
||||
|
||||
splits.forEach(function (split) {
|
||||
var bufs = create(xs, split);
|
||||
var buf = new Buffer(xs);
|
||||
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
for (var j = i; j < xs.length; j++) {
|
||||
var t0 = new Buffer(j - i);
|
||||
var t1 = new Buffer(j - i);
|
||||
|
||||
assert.eql(
|
||||
bufs.copy(t0, 0, i, j),
|
||||
buf.copy(t1, 0, i, j)
|
||||
);
|
||||
|
||||
assert.eql(
|
||||
[].slice.call(t0),
|
||||
[].slice.call(t1)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.push = function () {
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer([0]));
|
||||
bufs.push(new Buffer([1,2,3]));
|
||||
bufs.push(new Buffer([4,5]));
|
||||
bufs.push(new Buffer([6,7,8,9]));
|
||||
assert.eql(
|
||||
[].slice.call(bufs.slice()),
|
||||
[0,1,2,3,4,5,6,7,8,9]
|
||||
);
|
||||
|
||||
assert.throws(function () {
|
||||
bufs.push(new Buffer([11,12]), 'moo');
|
||||
});
|
||||
assert.eql(bufs.buffers.length, 4);
|
||||
};
|
||||
|
||||
exports.unshift = function () {
|
||||
var bufs = Buffers();
|
||||
bufs.unshift(new Buffer([6,7,8,9]));
|
||||
bufs.unshift(new Buffer([4,5]));
|
||||
bufs.unshift(new Buffer([1,2,3]));
|
||||
bufs.unshift(new Buffer([0]));
|
||||
assert.eql(
|
||||
[].slice.call(bufs.slice()),
|
||||
[0,1,2,3,4,5,6,7,8,9]
|
||||
);
|
||||
assert.throws(function () {
|
||||
bufs.unshift(new Buffer([-2,-1]), 'moo');
|
||||
});
|
||||
assert.eql(bufs.buffers.length, 4);
|
||||
};
|
||||
|
||||
exports.get = function () {
|
||||
var bufs = Buffers();
|
||||
bufs.unshift(new Buffer([6,7,8,9]));
|
||||
bufs.unshift(new Buffer([4,5]));
|
||||
bufs.unshift(new Buffer([1,2,3]));
|
||||
bufs.unshift(new Buffer([0]));
|
||||
assert.eql( bufs.get(0), 0 );
|
||||
assert.eql( bufs.get(1), 1 );
|
||||
assert.eql( bufs.get(2), 2 );
|
||||
assert.eql( bufs.get(3), 3 );
|
||||
assert.eql( bufs.get(4), 4 );
|
||||
assert.eql( bufs.get(5), 5 );
|
||||
assert.eql( bufs.get(6), 6 );
|
||||
assert.eql( bufs.get(7), 7 );
|
||||
assert.eql( bufs.get(8), 8 );
|
||||
assert.eql( bufs.get(9), 9 );
|
||||
};
|
||||
|
||||
exports.set = function () {
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer("Hel"));
|
||||
bufs.push(new Buffer("lo"));
|
||||
bufs.push(new Buffer("!"));
|
||||
bufs.set(0, 'h'.charCodeAt(0) );
|
||||
bufs.set(3, 'L'.charCodeAt(0) );
|
||||
bufs.set(5, '.'.charCodeAt(0) );
|
||||
assert.eql( bufs.slice(0).toString(), 'helLo.' );
|
||||
};
|
||||
|
||||
exports.indexOf = function () {
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer("Hel"));
|
||||
bufs.push(new Buffer("lo,"));
|
||||
bufs.push(new Buffer(" how are "));
|
||||
bufs.push(new Buffer("you"));
|
||||
bufs.push(new Buffer("?"));
|
||||
assert.eql( bufs.indexOf("Hello"), 0 );
|
||||
assert.eql( bufs.indexOf("Hello", 1), -1 );
|
||||
assert.eql( bufs.indexOf("ello"), 1 );
|
||||
assert.eql( bufs.indexOf("ello", 1), 1 );
|
||||
assert.eql( bufs.indexOf("ello", 2), -1 );
|
||||
assert.eql( bufs.indexOf("e"), 1 );
|
||||
assert.eql( bufs.indexOf("e", 2), 13 );
|
||||
assert.eql( bufs.indexOf(new Buffer([0x65]), 2), 13 );
|
||||
};
|
1
app/node_modules/chainsaw/.npmignore
generated
vendored
Normal file
1
app/node_modules/chainsaw/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
157
app/node_modules/chainsaw/README.markdown
generated
vendored
Normal file
157
app/node_modules/chainsaw/README.markdown
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
Chainsaw
|
||||
========
|
||||
|
||||
Build chainable fluent interfaces the easy way in node.js.
|
||||
|
||||
With this meta-module you can write modules with chainable interfaces.
|
||||
Chainsaw takes care of all of the boring details and makes nested flow control
|
||||
super simple too.
|
||||
|
||||
Just call `Chainsaw` with a constructor function like in the examples below.
|
||||
In your methods, just do `saw.next()` to move along to the next event and
|
||||
`saw.nest()` to create a nested chain.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
add_do.js
|
||||
---------
|
||||
|
||||
This silly example adds values with a chainsaw.
|
||||
|
||||
var Chainsaw = require('chainsaw');
|
||||
|
||||
function AddDo (sum) {
|
||||
return Chainsaw(function (saw) {
|
||||
this.add = function (n) {
|
||||
sum += n;
|
||||
saw.next();
|
||||
};
|
||||
|
||||
this.do = function (cb) {
|
||||
saw.nest(cb, sum);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
AddDo(0)
|
||||
.add(5)
|
||||
.add(10)
|
||||
.do(function (sum) {
|
||||
if (sum > 12) this.add(-10);
|
||||
})
|
||||
.do(function (sum) {
|
||||
console.log('Sum: ' + sum);
|
||||
})
|
||||
;
|
||||
|
||||
Output:
|
||||
Sum: 5
|
||||
|
||||
prompt.js
|
||||
---------
|
||||
|
||||
This example provides a wrapper on top of stdin with the help of
|
||||
[node-lazy](https://github.com/pkrumins/node-lazy) for line-processing.
|
||||
|
||||
var Chainsaw = require('chainsaw');
|
||||
var Lazy = require('lazy');
|
||||
|
||||
module.exports = Prompt;
|
||||
function Prompt (stream) {
|
||||
var waiting = [];
|
||||
var lines = [];
|
||||
var lazy = Lazy(stream).lines.map(String)
|
||||
.forEach(function (line) {
|
||||
if (waiting.length) {
|
||||
var w = waiting.shift();
|
||||
w(line);
|
||||
}
|
||||
else lines.push(line);
|
||||
})
|
||||
;
|
||||
|
||||
var vars = {};
|
||||
return Chainsaw(function (saw) {
|
||||
this.getline = function (f) {
|
||||
var g = function (line) {
|
||||
saw.nest(f, line, vars);
|
||||
};
|
||||
|
||||
if (lines.length) g(lines.shift());
|
||||
else waiting.push(g);
|
||||
};
|
||||
|
||||
this.do = function (cb) {
|
||||
saw.nest(cb, vars);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
And now for the new Prompt() module in action:
|
||||
|
||||
var util = require('util');
|
||||
var stdin = process.openStdin();
|
||||
|
||||
Prompt(stdin)
|
||||
.do(function () {
|
||||
util.print('x = ');
|
||||
})
|
||||
.getline(function (line, vars) {
|
||||
vars.x = parseInt(line, 10);
|
||||
})
|
||||
.do(function () {
|
||||
util.print('y = ');
|
||||
})
|
||||
.getline(function (line, vars) {
|
||||
vars.y = parseInt(line, 10);
|
||||
})
|
||||
.do(function (vars) {
|
||||
if (vars.x + vars.y < 10) {
|
||||
util.print('z = ');
|
||||
this.getline(function (line) {
|
||||
vars.z = parseInt(line, 10);
|
||||
})
|
||||
}
|
||||
else {
|
||||
vars.z = 0;
|
||||
}
|
||||
})
|
||||
.do(function (vars) {
|
||||
console.log('x + y + z = ' + (vars.x + vars.y + vars.z));
|
||||
process.exit();
|
||||
})
|
||||
;
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
With [npm](http://github.com/isaacs/npm), just do:
|
||||
npm install chainsaw
|
||||
|
||||
or clone this project on github:
|
||||
|
||||
git clone http://github.com/substack/node-chainsaw.git
|
||||
|
||||
To run the tests with [expresso](http://github.com/visionmedia/expresso),
|
||||
just do:
|
||||
|
||||
expresso
|
||||
|
||||
|
||||
Light Mode vs Full Mode
|
||||
=======================
|
||||
|
||||
`node-chainsaw` supports two different modes. In full mode, every
|
||||
action is recorded, which allows you to replay actions using the
|
||||
`jump()`, `trap()` and `down()` methods.
|
||||
|
||||
However, if your chainsaws are long-lived, recording every action can
|
||||
consume a tremendous amount of memory, so we also offer a "light" mode
|
||||
where actions are not recorded and the aforementioned methods are
|
||||
disabled.
|
||||
|
||||
To enable light mode simply use `Chainsaw.light()` to construct your
|
||||
saw, instead of `Chainsaw()`.
|
||||
|
||||
|
25
app/node_modules/chainsaw/examples/add_do.js
generated
vendored
Normal file
25
app/node_modules/chainsaw/examples/add_do.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
var Chainsaw = require('chainsaw');
|
||||
|
||||
function AddDo (sum) {
|
||||
return Chainsaw(function (saw) {
|
||||
this.add = function (n) {
|
||||
sum += n;
|
||||
saw.next();
|
||||
};
|
||||
|
||||
this.do = function (cb) {
|
||||
saw.nest(cb, sum);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
AddDo(0)
|
||||
.add(5)
|
||||
.add(10)
|
||||
.do(function (sum) {
|
||||
if (sum > 12) this.add(-10);
|
||||
})
|
||||
.do(function (sum) {
|
||||
console.log('Sum: ' + sum);
|
||||
})
|
||||
;
|
67
app/node_modules/chainsaw/examples/prompt.js
generated
vendored
Normal file
67
app/node_modules/chainsaw/examples/prompt.js
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
var Chainsaw = require('chainsaw');
|
||||
var Lazy = require('lazy');
|
||||
|
||||
module.exports = Prompt;
|
||||
function Prompt (stream) {
|
||||
var waiting = [];
|
||||
var lines = [];
|
||||
var lazy = Lazy(stream).lines.map(String)
|
||||
.forEach(function (line) {
|
||||
if (waiting.length) {
|
||||
var w = waiting.shift();
|
||||
w(line);
|
||||
}
|
||||
else lines.push(line);
|
||||
})
|
||||
;
|
||||
|
||||
var vars = {};
|
||||
return Chainsaw(function (saw) {
|
||||
this.getline = function (f) {
|
||||
var g = function (line) {
|
||||
saw.nest(f, line, vars);
|
||||
};
|
||||
|
||||
if (lines.length) g(lines.shift());
|
||||
else waiting.push(g);
|
||||
};
|
||||
|
||||
this.do = function (cb) {
|
||||
saw.nest(cb, vars);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
var util = require('util');
|
||||
if (__filename === process.argv[1]) {
|
||||
var stdin = process.openStdin();
|
||||
Prompt(stdin)
|
||||
.do(function () {
|
||||
util.print('x = ');
|
||||
})
|
||||
.getline(function (line, vars) {
|
||||
vars.x = parseInt(line, 10);
|
||||
})
|
||||
.do(function () {
|
||||
util.print('y = ');
|
||||
})
|
||||
.getline(function (line, vars) {
|
||||
vars.y = parseInt(line, 10);
|
||||
})
|
||||
.do(function (vars) {
|
||||
if (vars.x + vars.y < 10) {
|
||||
util.print('z = ');
|
||||
this.getline(function (line) {
|
||||
vars.z = parseInt(line, 10);
|
||||
})
|
||||
}
|
||||
else {
|
||||
vars.z = 0;
|
||||
}
|
||||
})
|
||||
.do(function (vars) {
|
||||
console.log('x + y + z = ' + (vars.x + vars.y + vars.z));
|
||||
process.exit();
|
||||
})
|
||||
;
|
||||
}
|
145
app/node_modules/chainsaw/index.js
generated
vendored
Normal file
145
app/node_modules/chainsaw/index.js
generated
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
var Traverse = require('traverse');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
|
||||
module.exports = Chainsaw;
|
||||
function Chainsaw (builder) {
|
||||
var saw = Chainsaw.saw(builder, {});
|
||||
var r = builder.call(saw.handlers, saw);
|
||||
if (r !== undefined) saw.handlers = r;
|
||||
saw.record();
|
||||
return saw.chain();
|
||||
};
|
||||
|
||||
Chainsaw.light = function ChainsawLight (builder) {
|
||||
var saw = Chainsaw.saw(builder, {});
|
||||
var r = builder.call(saw.handlers, saw);
|
||||
if (r !== undefined) saw.handlers = r;
|
||||
return saw.chain();
|
||||
};
|
||||
|
||||
Chainsaw.saw = function (builder, handlers) {
|
||||
var saw = new EventEmitter;
|
||||
saw.handlers = handlers;
|
||||
saw.actions = [];
|
||||
|
||||
saw.chain = function () {
|
||||
var ch = Traverse(saw.handlers).map(function (node) {
|
||||
if (this.isRoot) return node;
|
||||
var ps = this.path;
|
||||
|
||||
if (typeof node === 'function') {
|
||||
this.update(function () {
|
||||
saw.actions.push({
|
||||
path : ps,
|
||||
args : [].slice.call(arguments)
|
||||
});
|
||||
return ch;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
process.nextTick(function () {
|
||||
saw.emit('begin');
|
||||
saw.next();
|
||||
});
|
||||
|
||||
return ch;
|
||||
};
|
||||
|
||||
saw.pop = function () {
|
||||
return saw.actions.shift();
|
||||
};
|
||||
|
||||
saw.next = function () {
|
||||
var action = saw.pop();
|
||||
|
||||
if (!action) {
|
||||
saw.emit('end');
|
||||
}
|
||||
else if (!action.trap) {
|
||||
var node = saw.handlers;
|
||||
action.path.forEach(function (key) { node = node[key] });
|
||||
node.apply(saw.handlers, action.args);
|
||||
}
|
||||
};
|
||||
|
||||
saw.nest = function (cb) {
|
||||
var args = [].slice.call(arguments, 1);
|
||||
var autonext = true;
|
||||
|
||||
if (typeof cb === 'boolean') {
|
||||
var autonext = cb;
|
||||
cb = args.shift();
|
||||
}
|
||||
|
||||
var s = Chainsaw.saw(builder, {});
|
||||
var r = builder.call(s.handlers, s);
|
||||
|
||||
if (r !== undefined) s.handlers = r;
|
||||
|
||||
// If we are recording...
|
||||
if ("undefined" !== typeof saw.step) {
|
||||
// ... our children should, too
|
||||
s.record();
|
||||
}
|
||||
|
||||
cb.apply(s.chain(), args);
|
||||
if (autonext !== false) s.on('end', saw.next);
|
||||
};
|
||||
|
||||
saw.record = function () {
|
||||
upgradeChainsaw(saw);
|
||||
};
|
||||
|
||||
['trap', 'down', 'jump'].forEach(function (method) {
|
||||
saw[method] = function () {
|
||||
throw new Error("To use the trap, down and jump features, please "+
|
||||
"call record() first to start recording actions.");
|
||||
};
|
||||
});
|
||||
|
||||
return saw;
|
||||
};
|
||||
|
||||
function upgradeChainsaw(saw) {
|
||||
saw.step = 0;
|
||||
|
||||
// override pop
|
||||
saw.pop = function () {
|
||||
return saw.actions[saw.step++];
|
||||
};
|
||||
|
||||
saw.trap = function (name, cb) {
|
||||
var ps = Array.isArray(name) ? name : [name];
|
||||
saw.actions.push({
|
||||
path : ps,
|
||||
step : saw.step,
|
||||
cb : cb,
|
||||
trap : true
|
||||
});
|
||||
};
|
||||
|
||||
saw.down = function (name) {
|
||||
var ps = (Array.isArray(name) ? name : [name]).join('/');
|
||||
var i = saw.actions.slice(saw.step).map(function (x) {
|
||||
if (x.trap && x.step <= saw.step) return false;
|
||||
return x.path.join('/') == ps;
|
||||
}).indexOf(true);
|
||||
|
||||
if (i >= 0) saw.step += i;
|
||||
else saw.step = saw.actions.length;
|
||||
|
||||
var act = saw.actions[saw.step - 1];
|
||||
if (act && act.trap) {
|
||||
// It's a trap!
|
||||
saw.step = act.step;
|
||||
act.cb();
|
||||
}
|
||||
else saw.next();
|
||||
};
|
||||
|
||||
saw.jump = function (step) {
|
||||
saw.step = step;
|
||||
saw.next();
|
||||
};
|
||||
};
|
85
app/node_modules/chainsaw/package.json
generated
vendored
Normal file
85
app/node_modules/chainsaw/package.json
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "chainsaw@~0.1.0",
|
||||
"scope": null,
|
||||
"escapedName": "chainsaw",
|
||||
"name": "chainsaw",
|
||||
"rawSpec": "~0.1.0",
|
||||
"spec": ">=0.1.0 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\binary"
|
||||
]
|
||||
],
|
||||
"_defaultsLoaded": true,
|
||||
"_engineSupported": true,
|
||||
"_from": "chainsaw@>=0.1.0 <0.2.0",
|
||||
"_id": "chainsaw@0.1.0",
|
||||
"_inCache": true,
|
||||
"_location": "/chainsaw",
|
||||
"_nodeVersion": "v0.5.0-pre",
|
||||
"_npmVersion": "1.0.10",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "chainsaw@~0.1.0",
|
||||
"scope": null,
|
||||
"escapedName": "chainsaw",
|
||||
"name": "chainsaw",
|
||||
"rawSpec": "~0.1.0",
|
||||
"spec": ">=0.1.0 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/binary"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
|
||||
"_shasum": "5eab50b28afe58074d0d58291388828b5e5fbc98",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "chainsaw@~0.1.0",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\binary",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-chainsaw/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"traverse": ">=0.3.0 <0.4"
|
||||
},
|
||||
"description": "Build chainable fluent interfaces the easy way... with a freakin' chainsaw!",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "5eab50b28afe58074d0d58291388828b5e5fbc98",
|
||||
"tarball": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz"
|
||||
},
|
||||
"engine": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-chainsaw#readme",
|
||||
"keywords": [
|
||||
"chain",
|
||||
"fluent",
|
||||
"interface",
|
||||
"monad",
|
||||
"monadic"
|
||||
],
|
||||
"license": "MIT/X11",
|
||||
"main": "./index.js",
|
||||
"name": "chainsaw",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/node-chainsaw.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.1.0"
|
||||
}
|
418
app/node_modules/chainsaw/test/chainsaw.js
generated
vendored
Normal file
418
app/node_modules/chainsaw/test/chainsaw.js
generated
vendored
Normal file
|
@ -0,0 +1,418 @@
|
|||
var assert = require('assert');
|
||||
var Chainsaw = require('../index');
|
||||
|
||||
exports.getset = function () {
|
||||
var to = setTimeout(function () {
|
||||
assert.fail('builder never fired');
|
||||
}, 1000);
|
||||
|
||||
var ch = Chainsaw(function (saw) {
|
||||
clearTimeout(to);
|
||||
var num = 0;
|
||||
|
||||
this.get = function (cb) {
|
||||
cb(num);
|
||||
saw.next();
|
||||
};
|
||||
|
||||
this.set = function (n) {
|
||||
num = n;
|
||||
saw.next();
|
||||
};
|
||||
|
||||
var ti = setTimeout(function () {
|
||||
assert.fail('end event not emitted');
|
||||
}, 50);
|
||||
|
||||
saw.on('end', function () {
|
||||
clearTimeout(ti);
|
||||
assert.equal(times, 3);
|
||||
});
|
||||
});
|
||||
|
||||
var times = 0;
|
||||
ch
|
||||
.get(function (x) {
|
||||
assert.equal(x, 0);
|
||||
times ++;
|
||||
})
|
||||
.set(10)
|
||||
.get(function (x) {
|
||||
assert.equal(x, 10);
|
||||
times ++;
|
||||
})
|
||||
.set(20)
|
||||
.get(function (x) {
|
||||
assert.equal(x, 20);
|
||||
times ++;
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
exports.nest = function () {
|
||||
var ch = (function () {
|
||||
var vars = {};
|
||||
return Chainsaw(function (saw) {
|
||||
this.do = function (cb) {
|
||||
saw.nest(cb, vars);
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
var order = [];
|
||||
var to = setTimeout(function () {
|
||||
assert.fail("Didn't get to the end");
|
||||
}, 50);
|
||||
|
||||
ch
|
||||
.do(function (vars) {
|
||||
vars.x = 'y';
|
||||
order.push(1);
|
||||
|
||||
this
|
||||
.do(function (vs) {
|
||||
order.push(2);
|
||||
vs.x = 'x';
|
||||
})
|
||||
.do(function (vs) {
|
||||
order.push(3);
|
||||
vs.z = 'z';
|
||||
})
|
||||
;
|
||||
})
|
||||
.do(function (vars) {
|
||||
vars.y = 'y';
|
||||
order.push(4);
|
||||
})
|
||||
.do(function (vars) {
|
||||
assert.eql(order, [1,2,3,4]);
|
||||
assert.eql(vars, { x : 'x', y : 'y', z : 'z' });
|
||||
clearTimeout(to);
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
exports.nestWait = function () {
|
||||
var ch = (function () {
|
||||
var vars = {};
|
||||
return Chainsaw(function (saw) {
|
||||
this.do = function (cb) {
|
||||
saw.nest(cb, vars);
|
||||
};
|
||||
|
||||
this.wait = function (n) {
|
||||
setTimeout(function () {
|
||||
saw.next();
|
||||
}, n);
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
var order = [];
|
||||
var to = setTimeout(function () {
|
||||
assert.fail("Didn't get to the end");
|
||||
}, 1000);
|
||||
|
||||
var times = {};
|
||||
|
||||
ch
|
||||
.do(function (vars) {
|
||||
vars.x = 'y';
|
||||
order.push(1);
|
||||
|
||||
this
|
||||
.do(function (vs) {
|
||||
order.push(2);
|
||||
vs.x = 'x';
|
||||
times.x = Date.now();
|
||||
})
|
||||
.wait(50)
|
||||
.do(function (vs) {
|
||||
order.push(3);
|
||||
vs.z = 'z';
|
||||
|
||||
times.z = Date.now();
|
||||
var dt = times.z - times.x;
|
||||
assert.ok(dt >= 50 && dt < 75);
|
||||
})
|
||||
;
|
||||
})
|
||||
.do(function (vars) {
|
||||
vars.y = 'y';
|
||||
order.push(4);
|
||||
|
||||
times.y = Date.now();
|
||||
})
|
||||
.wait(100)
|
||||
.do(function (vars) {
|
||||
assert.eql(order, [1,2,3,4]);
|
||||
assert.eql(vars, { x : 'x', y : 'y', z : 'z' });
|
||||
clearTimeout(to);
|
||||
|
||||
times.end = Date.now();
|
||||
var dt = times.end - times.y;
|
||||
assert.ok(dt >= 100 && dt < 125)
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
exports.nestNext = function () {
|
||||
var ch = (function () {
|
||||
var vars = {};
|
||||
return Chainsaw(function (saw) {
|
||||
this.do = function (cb) {
|
||||
saw.nest(false, function () {
|
||||
var args = [].slice.call(arguments);
|
||||
args.push(saw.next);
|
||||
cb.apply(this, args);
|
||||
}, vars);
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
var order = [];
|
||||
var to = setTimeout(function () {
|
||||
assert.fail("Didn't get to the end");
|
||||
}, 500);
|
||||
|
||||
var times = [];
|
||||
|
||||
ch
|
||||
.do(function (vars, next_) {
|
||||
vars.x = 'y';
|
||||
order.push(1);
|
||||
|
||||
this
|
||||
.do(function (vs, next) {
|
||||
order.push(2);
|
||||
vs.x = 'x';
|
||||
setTimeout(next, 30);
|
||||
})
|
||||
.do(function (vs, next) {
|
||||
order.push(3);
|
||||
vs.z = 'z';
|
||||
setTimeout(next, 10);
|
||||
})
|
||||
.do(function () {
|
||||
setTimeout(next_, 20);
|
||||
})
|
||||
;
|
||||
})
|
||||
.do(function (vars, next) {
|
||||
vars.y = 'y';
|
||||
order.push(4);
|
||||
setTimeout(next, 5);
|
||||
})
|
||||
.do(function (vars) {
|
||||
assert.eql(order, [1,2,3,4]);
|
||||
assert.eql(vars, { x : 'x', y : 'y', z : 'z' });
|
||||
|
||||
clearTimeout(to);
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
exports.builder = function () {
|
||||
var cx = Chainsaw(function (saw) {
|
||||
this.x = function () {};
|
||||
});
|
||||
assert.ok(cx.x);
|
||||
|
||||
var cy = Chainsaw(function (saw) {
|
||||
return { y : function () {} };
|
||||
});
|
||||
assert.ok(cy.y);
|
||||
|
||||
var cz = Chainsaw(function (saw) {
|
||||
return { z : function (cb) { saw.nest(cb) } };
|
||||
});
|
||||
assert.ok(cz.z);
|
||||
|
||||
var to = setTimeout(function () {
|
||||
assert.fail("Nested z didn't run");
|
||||
}, 50);
|
||||
|
||||
cz.z(function () {
|
||||
clearTimeout(to);
|
||||
assert.ok(this.z);
|
||||
});
|
||||
};
|
||||
|
||||
this.attr = function () {
|
||||
var to = setTimeout(function () {
|
||||
assert.fail("attr chain didn't finish");
|
||||
}, 50);
|
||||
|
||||
var xy = [];
|
||||
var ch = Chainsaw(function (saw) {
|
||||
this.h = {
|
||||
x : function () {
|
||||
xy.push('x');
|
||||
saw.next();
|
||||
},
|
||||
y : function () {
|
||||
xy.push('y');
|
||||
saw.next();
|
||||
assert.eql(xy, ['x','y']);
|
||||
clearTimeout(to);
|
||||
}
|
||||
};
|
||||
});
|
||||
assert.ok(ch.h);
|
||||
assert.ok(ch.h.x);
|
||||
assert.ok(ch.h.y);
|
||||
|
||||
ch.h.x().h.y();
|
||||
};
|
||||
|
||||
exports.down = function () {
|
||||
var error = null;
|
||||
var s;
|
||||
var ch = Chainsaw(function (saw) {
|
||||
s = saw;
|
||||
this.raise = function (err) {
|
||||
error = err;
|
||||
saw.down('catch');
|
||||
};
|
||||
|
||||
this.do = function (cb) {
|
||||
cb.call(this);
|
||||
};
|
||||
|
||||
this.catch = function (cb) {
|
||||
if (error) {
|
||||
saw.nest(cb, error);
|
||||
error = null;
|
||||
}
|
||||
else saw.next();
|
||||
};
|
||||
});
|
||||
|
||||
var to = setTimeout(function () {
|
||||
assert.fail(".do() after .catch() didn't fire");
|
||||
}, 50);
|
||||
|
||||
ch
|
||||
.do(function () {
|
||||
this.raise('pow');
|
||||
})
|
||||
.do(function () {
|
||||
assert.fail("raise didn't skip over this do block");
|
||||
})
|
||||
.catch(function (err) {
|
||||
assert.equal(err, 'pow');
|
||||
})
|
||||
.do(function () {
|
||||
clearTimeout(to);
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
exports.trap = function () {
|
||||
var error = null;
|
||||
var ch = Chainsaw(function (saw) {
|
||||
var pars = 0;
|
||||
var stack = [];
|
||||
var i = 0;
|
||||
|
||||
this.par = function (cb) {
|
||||
pars ++;
|
||||
var j = i ++;
|
||||
cb.call(function () {
|
||||
pars --;
|
||||
stack[j] = [].slice.call(arguments);
|
||||
saw.down('result');
|
||||
});
|
||||
saw.next();
|
||||
};
|
||||
|
||||
this.join = function (cb) {
|
||||
saw.trap('result', function () {
|
||||
if (pars == 0) {
|
||||
cb.apply(this, stack);
|
||||
saw.next();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.raise = function (err) {
|
||||
error = err;
|
||||
saw.down('catch');
|
||||
};
|
||||
|
||||
this.do = function (cb) {
|
||||
cb.call(this);
|
||||
};
|
||||
|
||||
this.catch = function (cb) {
|
||||
if (error) {
|
||||
saw.nest(cb, error);
|
||||
error = null;
|
||||
}
|
||||
else saw.next();
|
||||
};
|
||||
});
|
||||
|
||||
var to = setTimeout(function () {
|
||||
assert.fail(".do() after .join() didn't fire");
|
||||
}, 100);
|
||||
var tj = setTimeout(function () {
|
||||
assert.fail('.join() never fired');
|
||||
}, 100);
|
||||
|
||||
var joined = false;
|
||||
ch
|
||||
.par(function () {
|
||||
setTimeout(this.bind(null, 1), 50);
|
||||
})
|
||||
.par(function () {
|
||||
setTimeout(this.bind(null, 2), 25);
|
||||
})
|
||||
.join(function (x, y) {
|
||||
assert.equal(x[0], 1);
|
||||
assert.equal(y[0], 2);
|
||||
clearTimeout(tj);
|
||||
joined = true;
|
||||
})
|
||||
.do(function () {
|
||||
clearTimeout(to);
|
||||
assert.ok(joined);
|
||||
})
|
||||
;
|
||||
};
|
||||
|
||||
exports.jump = function () {
|
||||
var to = setTimeout(function () {
|
||||
assert.fail('builder never fired');
|
||||
}, 50);
|
||||
|
||||
var xs = [ 4, 5, 6, -4, 8, 9, -1, 8 ];
|
||||
var xs_ = [];
|
||||
|
||||
var ch = Chainsaw(function (saw) {
|
||||
this.x = function (i) {
|
||||
xs_.push(i);
|
||||
saw.next();
|
||||
};
|
||||
|
||||
this.y = function (step) {
|
||||
var x = xs.shift();
|
||||
if (x > 0) saw.jump(step);
|
||||
else saw.next();
|
||||
};
|
||||
|
||||
saw.on('end', function () {
|
||||
clearTimeout(to);
|
||||
assert.eql(xs, [ 8 ]);
|
||||
assert.eql(xs_, [ 1, 1, 1, 1, 2, 3, 2, 3, 2, 3 ]);
|
||||
});
|
||||
});
|
||||
|
||||
ch
|
||||
.x(1)
|
||||
.y(0)
|
||||
.x(2)
|
||||
.x(3)
|
||||
.y(2)
|
||||
;
|
||||
};
|
4
app/node_modules/concat-map/.travis.yml
generated
vendored
Normal file
4
app/node_modules/concat-map/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.4
|
||||
- 0.6
|
18
app/node_modules/concat-map/LICENSE
generated
vendored
Normal file
18
app/node_modules/concat-map/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
This software is released under the MIT license:
|
||||
|
||||
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.
|
62
app/node_modules/concat-map/README.markdown
generated
vendored
Normal file
62
app/node_modules/concat-map/README.markdown
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
concat-map
|
||||
==========
|
||||
|
||||
Concatenative mapdashery.
|
||||
|
||||
[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map)
|
||||
|
||||
[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map)
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
``` js
|
||||
var concatMap = require('concat-map');
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
console.dir(ys);
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
```
|
||||
[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]
|
||||
```
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
``` js
|
||||
var concatMap = require('concat-map')
|
||||
```
|
||||
|
||||
concatMap(xs, fn)
|
||||
-----------------
|
||||
|
||||
Return an array of concatenated elements by calling `fn(x, i)` for each element
|
||||
`x` and each index `i` in the array `xs`.
|
||||
|
||||
When `fn(x, i)` returns an array, its result will be concatenated with the
|
||||
result array. If `fn(x, i)` returns anything else, that value will be pushed
|
||||
onto the end of the result array.
|
||||
|
||||
install
|
||||
=======
|
||||
|
||||
With [npm](http://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install concat-map
|
||||
```
|
||||
|
||||
license
|
||||
=======
|
||||
|
||||
MIT
|
||||
|
||||
notes
|
||||
=====
|
||||
|
||||
This module was written while sitting high above the ground in a tree.
|
6
app/node_modules/concat-map/example/map.js
generated
vendored
Normal file
6
app/node_modules/concat-map/example/map.js
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
var concatMap = require('../');
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
console.dir(ys);
|
13
app/node_modules/concat-map/index.js
generated
vendored
Normal file
13
app/node_modules/concat-map/index.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
module.exports = function (xs, fn) {
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
var x = fn(xs[i], i);
|
||||
if (isArray(x)) res.push.apply(res, x);
|
||||
else res.push(x);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
var isArray = Array.isArray || function (xs) {
|
||||
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||
};
|
117
app/node_modules/concat-map/package.json
generated
vendored
Normal file
117
app/node_modules/concat-map/package.json
generated
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "concat-map@0.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "concat-map",
|
||||
"name": "concat-map",
|
||||
"rawSpec": "0.0.1",
|
||||
"spec": "0.0.1",
|
||||
"type": "version"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\brace-expansion"
|
||||
]
|
||||
],
|
||||
"_from": "concat-map@0.0.1",
|
||||
"_id": "concat-map@0.0.1",
|
||||
"_inCache": true,
|
||||
"_location": "/concat-map",
|
||||
"_npmUser": {
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
},
|
||||
"_npmVersion": "1.3.21",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "concat-map@0.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "concat-map",
|
||||
"name": "concat-map",
|
||||
"rawSpec": "0.0.1",
|
||||
"spec": "0.0.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/brace-expansion"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "concat-map@0.0.1",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\brace-expansion",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/node-concat-map/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "concatenative mapdashery",
|
||||
"devDependencies": {
|
||||
"tape": "~2.4.0"
|
||||
},
|
||||
"directories": {
|
||||
"example": "example",
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||
"tarball": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/substack/node-concat-map",
|
||||
"keywords": [
|
||||
"concat",
|
||||
"concatMap",
|
||||
"map",
|
||||
"functional",
|
||||
"higher-order"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "substack",
|
||||
"email": "mail@substack.net"
|
||||
}
|
||||
],
|
||||
"name": "concat-map",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/node-concat-map.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": {
|
||||
"ie": [
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
],
|
||||
"ff": [
|
||||
3.5,
|
||||
10,
|
||||
15
|
||||
],
|
||||
"chrome": [
|
||||
10,
|
||||
22
|
||||
],
|
||||
"safari": [
|
||||
5.1
|
||||
],
|
||||
"opera": [
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "0.0.1"
|
||||
}
|
39
app/node_modules/concat-map/test/map.js
generated
vendored
Normal file
39
app/node_modules/concat-map/test/map.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
var concatMap = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
test('empty or not', function (t) {
|
||||
var xs = [ 1, 2, 3, 4, 5, 6 ];
|
||||
var ixes = [];
|
||||
var ys = concatMap(xs, function (x, ix) {
|
||||
ixes.push(ix);
|
||||
return x % 2 ? [ x - 0.1, x, x + 0.1 ] : [];
|
||||
});
|
||||
t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]);
|
||||
t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('always something', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ];
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('scalars', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function (x) {
|
||||
return x === 'b' ? [ 'B', 'B', 'B' ] : x;
|
||||
});
|
||||
t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('undefs', function (t) {
|
||||
var xs = [ 'a', 'b', 'c', 'd' ];
|
||||
var ys = concatMap(xs, function () {});
|
||||
t.same(ys, [ undefined, undefined, undefined, undefined ]);
|
||||
t.end();
|
||||
});
|
19
app/node_modules/core-util-is/LICENSE
generated
vendored
Normal file
19
app/node_modules/core-util-is/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
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.
|
3
app/node_modules/core-util-is/README.md
generated
vendored
Normal file
3
app/node_modules/core-util-is/README.md
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# core-util-is
|
||||
|
||||
The `util.is*` functions introduced in Node v0.12.
|
604
app/node_modules/core-util-is/float.patch
generated
vendored
Normal file
604
app/node_modules/core-util-is/float.patch
generated
vendored
Normal file
|
@ -0,0 +1,604 @@
|
|||
diff --git a/lib/util.js b/lib/util.js
|
||||
index a03e874..9074e8e 100644
|
||||
--- a/lib/util.js
|
||||
+++ b/lib/util.js
|
||||
@@ -19,430 +19,6 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-var formatRegExp = /%[sdj%]/g;
|
||||
-exports.format = function(f) {
|
||||
- if (!isString(f)) {
|
||||
- var objects = [];
|
||||
- for (var i = 0; i < arguments.length; i++) {
|
||||
- objects.push(inspect(arguments[i]));
|
||||
- }
|
||||
- return objects.join(' ');
|
||||
- }
|
||||
-
|
||||
- var i = 1;
|
||||
- var args = arguments;
|
||||
- var len = args.length;
|
||||
- var str = String(f).replace(formatRegExp, function(x) {
|
||||
- if (x === '%%') return '%';
|
||||
- if (i >= len) return x;
|
||||
- switch (x) {
|
||||
- case '%s': return String(args[i++]);
|
||||
- case '%d': return Number(args[i++]);
|
||||
- case '%j':
|
||||
- try {
|
||||
- return JSON.stringify(args[i++]);
|
||||
- } catch (_) {
|
||||
- return '[Circular]';
|
||||
- }
|
||||
- default:
|
||||
- return x;
|
||||
- }
|
||||
- });
|
||||
- for (var x = args[i]; i < len; x = args[++i]) {
|
||||
- if (isNull(x) || !isObject(x)) {
|
||||
- str += ' ' + x;
|
||||
- } else {
|
||||
- str += ' ' + inspect(x);
|
||||
- }
|
||||
- }
|
||||
- return str;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-// Mark that a method should not be used.
|
||||
-// Returns a modified function which warns once by default.
|
||||
-// If --no-deprecation is set, then it is a no-op.
|
||||
-exports.deprecate = function(fn, msg) {
|
||||
- // Allow for deprecating things in the process of starting up.
|
||||
- if (isUndefined(global.process)) {
|
||||
- return function() {
|
||||
- return exports.deprecate(fn, msg).apply(this, arguments);
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- if (process.noDeprecation === true) {
|
||||
- return fn;
|
||||
- }
|
||||
-
|
||||
- var warned = false;
|
||||
- function deprecated() {
|
||||
- if (!warned) {
|
||||
- if (process.throwDeprecation) {
|
||||
- throw new Error(msg);
|
||||
- } else if (process.traceDeprecation) {
|
||||
- console.trace(msg);
|
||||
- } else {
|
||||
- console.error(msg);
|
||||
- }
|
||||
- warned = true;
|
||||
- }
|
||||
- return fn.apply(this, arguments);
|
||||
- }
|
||||
-
|
||||
- return deprecated;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-var debugs = {};
|
||||
-var debugEnviron;
|
||||
-exports.debuglog = function(set) {
|
||||
- if (isUndefined(debugEnviron))
|
||||
- debugEnviron = process.env.NODE_DEBUG || '';
|
||||
- set = set.toUpperCase();
|
||||
- if (!debugs[set]) {
|
||||
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||
- var pid = process.pid;
|
||||
- debugs[set] = function() {
|
||||
- var msg = exports.format.apply(exports, arguments);
|
||||
- console.error('%s %d: %s', set, pid, msg);
|
||||
- };
|
||||
- } else {
|
||||
- debugs[set] = function() {};
|
||||
- }
|
||||
- }
|
||||
- return debugs[set];
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Echos the value of a value. Trys to print the value out
|
||||
- * in the best way possible given the different types.
|
||||
- *
|
||||
- * @param {Object} obj The object to print out.
|
||||
- * @param {Object} opts Optional options object that alters the output.
|
||||
- */
|
||||
-/* legacy: obj, showHidden, depth, colors*/
|
||||
-function inspect(obj, opts) {
|
||||
- // default options
|
||||
- var ctx = {
|
||||
- seen: [],
|
||||
- stylize: stylizeNoColor
|
||||
- };
|
||||
- // legacy...
|
||||
- if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||
- if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||
- if (isBoolean(opts)) {
|
||||
- // legacy...
|
||||
- ctx.showHidden = opts;
|
||||
- } else if (opts) {
|
||||
- // got an "options" object
|
||||
- exports._extend(ctx, opts);
|
||||
- }
|
||||
- // set default options
|
||||
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||
- if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||
- if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||
- if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||
- return formatValue(ctx, obj, ctx.depth);
|
||||
-}
|
||||
-exports.inspect = inspect;
|
||||
-
|
||||
-
|
||||
-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
-inspect.colors = {
|
||||
- 'bold' : [1, 22],
|
||||
- 'italic' : [3, 23],
|
||||
- 'underline' : [4, 24],
|
||||
- 'inverse' : [7, 27],
|
||||
- 'white' : [37, 39],
|
||||
- 'grey' : [90, 39],
|
||||
- 'black' : [30, 39],
|
||||
- 'blue' : [34, 39],
|
||||
- 'cyan' : [36, 39],
|
||||
- 'green' : [32, 39],
|
||||
- 'magenta' : [35, 39],
|
||||
- 'red' : [31, 39],
|
||||
- 'yellow' : [33, 39]
|
||||
-};
|
||||
-
|
||||
-// Don't use 'blue' not visible on cmd.exe
|
||||
-inspect.styles = {
|
||||
- 'special': 'cyan',
|
||||
- 'number': 'yellow',
|
||||
- 'boolean': 'yellow',
|
||||
- 'undefined': 'grey',
|
||||
- 'null': 'bold',
|
||||
- 'string': 'green',
|
||||
- 'date': 'magenta',
|
||||
- // "name": intentionally not styling
|
||||
- 'regexp': 'red'
|
||||
-};
|
||||
-
|
||||
-
|
||||
-function stylizeWithColor(str, styleType) {
|
||||
- var style = inspect.styles[styleType];
|
||||
-
|
||||
- if (style) {
|
||||
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||
- '\u001b[' + inspect.colors[style][1] + 'm';
|
||||
- } else {
|
||||
- return str;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function stylizeNoColor(str, styleType) {
|
||||
- return str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function arrayToHash(array) {
|
||||
- var hash = {};
|
||||
-
|
||||
- array.forEach(function(val, idx) {
|
||||
- hash[val] = true;
|
||||
- });
|
||||
-
|
||||
- return hash;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatValue(ctx, value, recurseTimes) {
|
||||
- // Provide a hook for user-specified inspect functions.
|
||||
- // Check that value is an object with an inspect function on it
|
||||
- if (ctx.customInspect &&
|
||||
- value &&
|
||||
- isFunction(value.inspect) &&
|
||||
- // Filter out the util module, it's inspect function is special
|
||||
- value.inspect !== exports.inspect &&
|
||||
- // Also filter out any prototype objects using the circular check.
|
||||
- !(value.constructor && value.constructor.prototype === value)) {
|
||||
- var ret = value.inspect(recurseTimes, ctx);
|
||||
- if (!isString(ret)) {
|
||||
- ret = formatValue(ctx, ret, recurseTimes);
|
||||
- }
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- // Primitive types cannot have properties
|
||||
- var primitive = formatPrimitive(ctx, value);
|
||||
- if (primitive) {
|
||||
- return primitive;
|
||||
- }
|
||||
-
|
||||
- // Look up the keys of the object.
|
||||
- var keys = Object.keys(value);
|
||||
- var visibleKeys = arrayToHash(keys);
|
||||
-
|
||||
- if (ctx.showHidden) {
|
||||
- keys = Object.getOwnPropertyNames(value);
|
||||
- }
|
||||
-
|
||||
- // Some type of object without properties can be shortcutted.
|
||||
- if (keys.length === 0) {
|
||||
- if (isFunction(value)) {
|
||||
- var name = value.name ? ': ' + value.name : '';
|
||||
- return ctx.stylize('[Function' + name + ']', 'special');
|
||||
- }
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- }
|
||||
- if (isDate(value)) {
|
||||
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
- }
|
||||
- if (isError(value)) {
|
||||
- return formatError(value);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- var base = '', array = false, braces = ['{', '}'];
|
||||
-
|
||||
- // Make Array say that they are Array
|
||||
- if (isArray(value)) {
|
||||
- array = true;
|
||||
- braces = ['[', ']'];
|
||||
- }
|
||||
-
|
||||
- // Make functions say that they are functions
|
||||
- if (isFunction(value)) {
|
||||
- var n = value.name ? ': ' + value.name : '';
|
||||
- base = ' [Function' + n + ']';
|
||||
- }
|
||||
-
|
||||
- // Make RegExps say that they are RegExps
|
||||
- if (isRegExp(value)) {
|
||||
- base = ' ' + RegExp.prototype.toString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make dates with properties first say the date
|
||||
- if (isDate(value)) {
|
||||
- base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make error with message first say the error
|
||||
- if (isError(value)) {
|
||||
- base = ' ' + formatError(value);
|
||||
- }
|
||||
-
|
||||
- if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
- return braces[0] + base + braces[1];
|
||||
- }
|
||||
-
|
||||
- if (recurseTimes < 0) {
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- } else {
|
||||
- return ctx.stylize('[Object]', 'special');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- ctx.seen.push(value);
|
||||
-
|
||||
- var output;
|
||||
- if (array) {
|
||||
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
- } else {
|
||||
- output = keys.map(function(key) {
|
||||
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- ctx.seen.pop();
|
||||
-
|
||||
- return reduceToSingleString(output, base, braces);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatPrimitive(ctx, value) {
|
||||
- if (isUndefined(value))
|
||||
- return ctx.stylize('undefined', 'undefined');
|
||||
- if (isString(value)) {
|
||||
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
- .replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"') + '\'';
|
||||
- return ctx.stylize(simple, 'string');
|
||||
- }
|
||||
- if (isNumber(value)) {
|
||||
- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
|
||||
- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
|
||||
- if (value === 0 && 1 / value < 0)
|
||||
- return ctx.stylize('-0', 'number');
|
||||
- return ctx.stylize('' + value, 'number');
|
||||
- }
|
||||
- if (isBoolean(value))
|
||||
- return ctx.stylize('' + value, 'boolean');
|
||||
- // For some reason typeof null is "object", so special case here.
|
||||
- if (isNull(value))
|
||||
- return ctx.stylize('null', 'null');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatError(value) {
|
||||
- return '[' + Error.prototype.toString.call(value) + ']';
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
- var output = [];
|
||||
- for (var i = 0, l = value.length; i < l; ++i) {
|
||||
- if (hasOwnProperty(value, String(i))) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- String(i), true));
|
||||
- } else {
|
||||
- output.push('');
|
||||
- }
|
||||
- }
|
||||
- keys.forEach(function(key) {
|
||||
- if (!key.match(/^\d+$/)) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- key, true));
|
||||
- }
|
||||
- });
|
||||
- return output;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
- var name, str, desc;
|
||||
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
- if (desc.get) {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
- } else {
|
||||
- str = ctx.stylize('[Getter]', 'special');
|
||||
- }
|
||||
- } else {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Setter]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (!hasOwnProperty(visibleKeys, key)) {
|
||||
- name = '[' + key + ']';
|
||||
- }
|
||||
- if (!str) {
|
||||
- if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
- if (isNull(recurseTimes)) {
|
||||
- str = formatValue(ctx, desc.value, null);
|
||||
- } else {
|
||||
- str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
- }
|
||||
- if (str.indexOf('\n') > -1) {
|
||||
- if (array) {
|
||||
- str = str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n').substr(2);
|
||||
- } else {
|
||||
- str = '\n' + str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n');
|
||||
- }
|
||||
- }
|
||||
- } else {
|
||||
- str = ctx.stylize('[Circular]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (isUndefined(name)) {
|
||||
- if (array && key.match(/^\d+$/)) {
|
||||
- return str;
|
||||
- }
|
||||
- name = JSON.stringify('' + key);
|
||||
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
- name = name.substr(1, name.length - 2);
|
||||
- name = ctx.stylize(name, 'name');
|
||||
- } else {
|
||||
- name = name.replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"')
|
||||
- .replace(/(^"|"$)/g, "'");
|
||||
- name = ctx.stylize(name, 'string');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return name + ': ' + str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function reduceToSingleString(output, base, braces) {
|
||||
- var numLinesEst = 0;
|
||||
- var length = output.reduce(function(prev, cur) {
|
||||
- numLinesEst++;
|
||||
- if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
- }, 0);
|
||||
-
|
||||
- if (length > 60) {
|
||||
- return braces[0] +
|
||||
- (base === '' ? '' : base + '\n ') +
|
||||
- ' ' +
|
||||
- output.join(',\n ') +
|
||||
- ' ' +
|
||||
- braces[1];
|
||||
- }
|
||||
-
|
||||
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
-}
|
||||
-
|
||||
-
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
function isArray(ar) {
|
||||
@@ -522,166 +98,10 @@ function isPrimitive(arg) {
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
function isBuffer(arg) {
|
||||
- return arg instanceof Buffer;
|
||||
+ return Buffer.isBuffer(arg);
|
||||
}
|
||||
exports.isBuffer = isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function pad(n) {
|
||||
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||
- 'Oct', 'Nov', 'Dec'];
|
||||
-
|
||||
-// 26 Feb 16:19:34
|
||||
-function timestamp() {
|
||||
- var d = new Date();
|
||||
- var time = [pad(d.getHours()),
|
||||
- pad(d.getMinutes()),
|
||||
- pad(d.getSeconds())].join(':');
|
||||
- return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// log is just a thin wrapper to console.log that prepends a timestamp
|
||||
-exports.log = function() {
|
||||
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Inherit the prototype methods from one constructor into another.
|
||||
- *
|
||||
- * The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||
- * function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||
- * during bootstrapping this function needs to be rewritten using some native
|
||||
- * functions as prototype setup using normal JavaScript does not work as
|
||||
- * expected during bootstrapping (see mirror.js in r114903).
|
||||
- *
|
||||
- * @param {function} ctor Constructor function which needs to inherit the
|
||||
- * prototype.
|
||||
- * @param {function} superCtor Constructor function to inherit prototype from.
|
||||
- */
|
||||
-exports.inherits = function(ctor, superCtor) {
|
||||
- ctor.super_ = superCtor;
|
||||
- ctor.prototype = Object.create(superCtor.prototype, {
|
||||
- constructor: {
|
||||
- value: ctor,
|
||||
- enumerable: false,
|
||||
- writable: true,
|
||||
- configurable: true
|
||||
- }
|
||||
- });
|
||||
-};
|
||||
-
|
||||
-exports._extend = function(origin, add) {
|
||||
- // Don't do anything if add isn't an object
|
||||
- if (!add || !isObject(add)) return origin;
|
||||
-
|
||||
- var keys = Object.keys(add);
|
||||
- var i = keys.length;
|
||||
- while (i--) {
|
||||
- origin[keys[i]] = add[keys[i]];
|
||||
- }
|
||||
- return origin;
|
||||
-};
|
||||
-
|
||||
-function hasOwnProperty(obj, prop) {
|
||||
- return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// Deprecated old stuff.
|
||||
-
|
||||
-exports.p = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- console.error(exports.inspect(arguments[i]));
|
||||
- }
|
||||
-}, 'util.p: Use console.error() instead');
|
||||
-
|
||||
-
|
||||
-exports.exec = exports.deprecate(function() {
|
||||
- return require('child_process').exec.apply(this, arguments);
|
||||
-}, 'util.exec is now called `child_process.exec`.');
|
||||
-
|
||||
-
|
||||
-exports.print = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(String(arguments[i]));
|
||||
- }
|
||||
-}, 'util.print: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.puts = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.puts: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.debug = exports.deprecate(function(x) {
|
||||
- process.stderr.write('DEBUG: ' + x + '\n');
|
||||
-}, 'util.debug: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.error = exports.deprecate(function(x) {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stderr.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.error: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
|
||||
- var callbackCalled = false;
|
||||
-
|
||||
- function call(a, b, c) {
|
||||
- if (callback && !callbackCalled) {
|
||||
- callback(a, b, c);
|
||||
- callbackCalled = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- readStream.addListener('data', function(chunk) {
|
||||
- if (writeStream.write(chunk) === false) readStream.pause();
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('drain', function() {
|
||||
- readStream.resume();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('end', function() {
|
||||
- writeStream.end();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('close', function() {
|
||||
- call();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('error', function(err) {
|
||||
- writeStream.end();
|
||||
- call(err);
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('error', function(err) {
|
||||
- readStream.destroy();
|
||||
- call(err);
|
||||
- });
|
||||
-}, 'util.pump(): Use readableStream.pipe() instead');
|
||||
-
|
||||
-
|
||||
-var uv;
|
||||
-exports._errnoException = function(err, syscall) {
|
||||
- if (isUndefined(uv)) uv = process.binding('uv');
|
||||
- var errname = uv.errname(err);
|
||||
- var e = new Error(syscall + ' ' + errname);
|
||||
- e.code = errname;
|
||||
- e.errno = errname;
|
||||
- e.syscall = syscall;
|
||||
- return e;
|
||||
-};
|
||||
+}
|
107
app/node_modules/core-util-is/lib/util.js
generated
vendored
Normal file
107
app/node_modules/core-util-is/lib/util.js
generated
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
|
||||
function isArray(arg) {
|
||||
if (Array.isArray) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
return objectToString(arg) === '[object Array]';
|
||||
}
|
||||
exports.isArray = isArray;
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
exports.isBoolean = isBoolean;
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
exports.isNull = isNull;
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
exports.isSymbol = isSymbol;
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
exports.isUndefined = isUndefined;
|
||||
|
||||
function isRegExp(re) {
|
||||
return objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
exports.isRegExp = isRegExp;
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
exports.isObject = isObject;
|
||||
|
||||
function isDate(d) {
|
||||
return objectToString(d) === '[object Date]';
|
||||
}
|
||||
exports.isDate = isDate;
|
||||
|
||||
function isError(e) {
|
||||
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
exports.isError = isError;
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
exports.isBuffer = Buffer.isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
94
app/node_modules/core-util-is/package.json
generated
vendored
Normal file
94
app/node_modules/core-util-is/package.json
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "core-util-is@~1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "core-util-is",
|
||||
"name": "core-util-is",
|
||||
"rawSpec": "~1.0.0",
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\readable-stream"
|
||||
]
|
||||
],
|
||||
"_from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"_id": "core-util-is@1.0.2",
|
||||
"_inCache": true,
|
||||
"_location": "/core-util-is",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.3.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "core-util-is@~1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "core-util-is",
|
||||
"name": "core-util-is",
|
||||
"rawSpec": "~1.0.0",
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/readable-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "core-util-is@~1.0.0",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\readable-stream",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/core-util-is/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "The `util.is*` functions introduced in Node v0.12.",
|
||||
"devDependencies": {
|
||||
"tap": "^2.3.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"tarball": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||
},
|
||||
"gitHead": "a177da234df5638b363ddc15fa324619a38577c8",
|
||||
"homepage": "https://github.com/isaacs/core-util-is#readme",
|
||||
"keywords": [
|
||||
"util",
|
||||
"isBuffer",
|
||||
"isArray",
|
||||
"isNumber",
|
||||
"isString",
|
||||
"isRegExp",
|
||||
"isThis",
|
||||
"isThat",
|
||||
"polyfill"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/util.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"name": "core-util-is",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/core-util-is.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
68
app/node_modules/core-util-is/test.js
generated
vendored
Normal file
68
app/node_modules/core-util-is/test.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
var assert = require('tap');
|
||||
|
||||
var t = require('./lib/util');
|
||||
|
||||
assert.equal(t.isArray([]), true);
|
||||
assert.equal(t.isArray({}), false);
|
||||
|
||||
assert.equal(t.isBoolean(null), false);
|
||||
assert.equal(t.isBoolean(true), true);
|
||||
assert.equal(t.isBoolean(false), true);
|
||||
|
||||
assert.equal(t.isNull(null), true);
|
||||
assert.equal(t.isNull(undefined), false);
|
||||
assert.equal(t.isNull(false), false);
|
||||
assert.equal(t.isNull(), false);
|
||||
|
||||
assert.equal(t.isNullOrUndefined(null), true);
|
||||
assert.equal(t.isNullOrUndefined(undefined), true);
|
||||
assert.equal(t.isNullOrUndefined(false), false);
|
||||
assert.equal(t.isNullOrUndefined(), true);
|
||||
|
||||
assert.equal(t.isNumber(null), false);
|
||||
assert.equal(t.isNumber('1'), false);
|
||||
assert.equal(t.isNumber(1), true);
|
||||
|
||||
assert.equal(t.isString(null), false);
|
||||
assert.equal(t.isString('1'), true);
|
||||
assert.equal(t.isString(1), false);
|
||||
|
||||
assert.equal(t.isSymbol(null), false);
|
||||
assert.equal(t.isSymbol('1'), false);
|
||||
assert.equal(t.isSymbol(1), false);
|
||||
assert.equal(t.isSymbol(Symbol()), true);
|
||||
|
||||
assert.equal(t.isUndefined(null), false);
|
||||
assert.equal(t.isUndefined(undefined), true);
|
||||
assert.equal(t.isUndefined(false), false);
|
||||
assert.equal(t.isUndefined(), true);
|
||||
|
||||
assert.equal(t.isRegExp(null), false);
|
||||
assert.equal(t.isRegExp('1'), false);
|
||||
assert.equal(t.isRegExp(new RegExp()), true);
|
||||
|
||||
assert.equal(t.isObject({}), true);
|
||||
assert.equal(t.isObject([]), true);
|
||||
assert.equal(t.isObject(new RegExp()), true);
|
||||
assert.equal(t.isObject(new Date()), true);
|
||||
|
||||
assert.equal(t.isDate(null), false);
|
||||
assert.equal(t.isDate('1'), false);
|
||||
assert.equal(t.isDate(new Date()), true);
|
||||
|
||||
assert.equal(t.isError(null), false);
|
||||
assert.equal(t.isError({ err: true }), false);
|
||||
assert.equal(t.isError(new Error()), true);
|
||||
|
||||
assert.equal(t.isFunction(null), false);
|
||||
assert.equal(t.isFunction({ }), false);
|
||||
assert.equal(t.isFunction(function() {}), true);
|
||||
|
||||
assert.equal(t.isPrimitive(null), true);
|
||||
assert.equal(t.isPrimitive(''), true);
|
||||
assert.equal(t.isPrimitive(0), true);
|
||||
assert.equal(t.isPrimitive(new Date()), false);
|
||||
|
||||
assert.equal(t.isBuffer(null), false);
|
||||
assert.equal(t.isBuffer({}), false);
|
||||
assert.equal(t.isBuffer(new Buffer(0)), true);
|
43
app/node_modules/fs.realpath/LICENSE
generated
vendored
Normal file
43
app/node_modules/fs.realpath/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
----
|
||||
|
||||
This library bundles a version of the `fs.realpath` and `fs.realpathSync`
|
||||
methods from Node.js v0.10 under the terms of the Node.js MIT license.
|
||||
|
||||
Node's license follows, also included at the header of `old.js` which contains
|
||||
the licensed code:
|
||||
|
||||
Copyright Joyent, Inc. and other Node contributors.
|
||||
|
||||
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.
|
33
app/node_modules/fs.realpath/README.md
generated
vendored
Normal file
33
app/node_modules/fs.realpath/README.md
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
# fs.realpath
|
||||
|
||||
A backwards-compatible fs.realpath for Node v6 and above
|
||||
|
||||
In Node v6, the JavaScript implementation of fs.realpath was replaced
|
||||
with a faster (but less resilient) native implementation. That raises
|
||||
new and platform-specific errors and cannot handle long or excessively
|
||||
symlink-looping paths.
|
||||
|
||||
This module handles those cases by detecting the new errors and
|
||||
falling back to the JavaScript implementation. On versions of Node
|
||||
prior to v6, it has no effect.
|
||||
|
||||
## USAGE
|
||||
|
||||
```js
|
||||
var rp = require('fs.realpath')
|
||||
|
||||
// async version
|
||||
rp.realpath(someLongAndLoopingPath, function (er, real) {
|
||||
// the ELOOP was handled, but it was a bit slower
|
||||
})
|
||||
|
||||
// sync version
|
||||
var real = rp.realpathSync(someLongAndLoopingPath)
|
||||
|
||||
// monkeypatch at your own risk!
|
||||
// This replaces the fs.realpath/fs.realpathSync builtins
|
||||
rp.monkeypatch()
|
||||
|
||||
// un-do the monkeypatching
|
||||
rp.unmonkeypatch()
|
||||
```
|
66
app/node_modules/fs.realpath/index.js
generated
vendored
Normal file
66
app/node_modules/fs.realpath/index.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
module.exports = realpath
|
||||
realpath.realpath = realpath
|
||||
realpath.sync = realpathSync
|
||||
realpath.realpathSync = realpathSync
|
||||
realpath.monkeypatch = monkeypatch
|
||||
realpath.unmonkeypatch = unmonkeypatch
|
||||
|
||||
var fs = require('fs')
|
||||
var origRealpath = fs.realpath
|
||||
var origRealpathSync = fs.realpathSync
|
||||
|
||||
var version = process.version
|
||||
var ok = /^v[0-5]\./.test(version)
|
||||
var old = require('./old.js')
|
||||
|
||||
function newError (er) {
|
||||
return er && er.syscall === 'realpath' && (
|
||||
er.code === 'ELOOP' ||
|
||||
er.code === 'ENOMEM' ||
|
||||
er.code === 'ENAMETOOLONG'
|
||||
)
|
||||
}
|
||||
|
||||
function realpath (p, cache, cb) {
|
||||
if (ok) {
|
||||
return origRealpath(p, cache, cb)
|
||||
}
|
||||
|
||||
if (typeof cache === 'function') {
|
||||
cb = cache
|
||||
cache = null
|
||||
}
|
||||
origRealpath(p, cache, function (er, result) {
|
||||
if (newError(er)) {
|
||||
old.realpath(p, cache, cb)
|
||||
} else {
|
||||
cb(er, result)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function realpathSync (p, cache) {
|
||||
if (ok) {
|
||||
return origRealpathSync(p, cache)
|
||||
}
|
||||
|
||||
try {
|
||||
return origRealpathSync(p, cache)
|
||||
} catch (er) {
|
||||
if (newError(er)) {
|
||||
return old.realpathSync(p, cache)
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function monkeypatch () {
|
||||
fs.realpath = realpath
|
||||
fs.realpathSync = realpathSync
|
||||
}
|
||||
|
||||
function unmonkeypatch () {
|
||||
fs.realpath = origRealpath
|
||||
fs.realpathSync = origRealpathSync
|
||||
}
|
303
app/node_modules/fs.realpath/old.js
generated
vendored
Normal file
303
app/node_modules/fs.realpath/old.js
generated
vendored
Normal file
|
@ -0,0 +1,303 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
var pathModule = require('path');
|
||||
var isWindows = process.platform === 'win32';
|
||||
var fs = require('fs');
|
||||
|
||||
// JavaScript implementation of realpath, ported from node pre-v6
|
||||
|
||||
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
||||
|
||||
function rethrow() {
|
||||
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
|
||||
// is fairly slow to generate.
|
||||
var callback;
|
||||
if (DEBUG) {
|
||||
var backtrace = new Error;
|
||||
callback = debugCallback;
|
||||
} else
|
||||
callback = missingCallback;
|
||||
|
||||
return callback;
|
||||
|
||||
function debugCallback(err) {
|
||||
if (err) {
|
||||
backtrace.message = err.message;
|
||||
err = backtrace;
|
||||
missingCallback(err);
|
||||
}
|
||||
}
|
||||
|
||||
function missingCallback(err) {
|
||||
if (err) {
|
||||
if (process.throwDeprecation)
|
||||
throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
|
||||
else if (!process.noDeprecation) {
|
||||
var msg = 'fs: missing callback ' + (err.stack || err.message);
|
||||
if (process.traceDeprecation)
|
||||
console.trace(msg);
|
||||
else
|
||||
console.error(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function maybeCallback(cb) {
|
||||
return typeof cb === 'function' ? cb : rethrow();
|
||||
}
|
||||
|
||||
var normalize = pathModule.normalize;
|
||||
|
||||
// Regexp that finds the next partion of a (partial) path
|
||||
// result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
|
||||
if (isWindows) {
|
||||
var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
||||
} else {
|
||||
var nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
||||
}
|
||||
|
||||
// Regex to find the device root, including trailing slash. E.g. 'c:\\'.
|
||||
if (isWindows) {
|
||||
var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
||||
} else {
|
||||
var splitRootRe = /^[\/]*/;
|
||||
}
|
||||
|
||||
exports.realpathSync = function realpathSync(p, cache) {
|
||||
// make p is absolute
|
||||
p = pathModule.resolve(p);
|
||||
|
||||
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
||||
return cache[p];
|
||||
}
|
||||
|
||||
var original = p,
|
||||
seenLinks = {},
|
||||
knownHard = {};
|
||||
|
||||
// current character position in p
|
||||
var pos;
|
||||
// the partial path so far, including a trailing slash if any
|
||||
var current;
|
||||
// the partial path without a trailing slash (except when pointing at a root)
|
||||
var base;
|
||||
// the partial path scanned in the previous round, with slash
|
||||
var previous;
|
||||
|
||||
start();
|
||||
|
||||
function start() {
|
||||
// Skip over roots
|
||||
var m = splitRootRe.exec(p);
|
||||
pos = m[0].length;
|
||||
current = m[0];
|
||||
base = m[0];
|
||||
previous = '';
|
||||
|
||||
// On windows, check that the root exists. On unix there is no need.
|
||||
if (isWindows && !knownHard[base]) {
|
||||
fs.lstatSync(base);
|
||||
knownHard[base] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// walk down the path, swapping out linked pathparts for their real
|
||||
// values
|
||||
// NB: p.length changes.
|
||||
while (pos < p.length) {
|
||||
// find the next part
|
||||
nextPartRe.lastIndex = pos;
|
||||
var result = nextPartRe.exec(p);
|
||||
previous = current;
|
||||
current += result[0];
|
||||
base = previous + result[1];
|
||||
pos = nextPartRe.lastIndex;
|
||||
|
||||
// continue if not a symlink
|
||||
if (knownHard[base] || (cache && cache[base] === base)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var resolvedLink;
|
||||
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
||||
// some known symbolic link. no need to stat again.
|
||||
resolvedLink = cache[base];
|
||||
} else {
|
||||
var stat = fs.lstatSync(base);
|
||||
if (!stat.isSymbolicLink()) {
|
||||
knownHard[base] = true;
|
||||
if (cache) cache[base] = base;
|
||||
continue;
|
||||
}
|
||||
|
||||
// read the link if it wasn't read before
|
||||
// dev/ino always return 0 on windows, so skip the check.
|
||||
var linkTarget = null;
|
||||
if (!isWindows) {
|
||||
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
||||
if (seenLinks.hasOwnProperty(id)) {
|
||||
linkTarget = seenLinks[id];
|
||||
}
|
||||
}
|
||||
if (linkTarget === null) {
|
||||
fs.statSync(base);
|
||||
linkTarget = fs.readlinkSync(base);
|
||||
}
|
||||
resolvedLink = pathModule.resolve(previous, linkTarget);
|
||||
// track this, if given a cache.
|
||||
if (cache) cache[base] = resolvedLink;
|
||||
if (!isWindows) seenLinks[id] = linkTarget;
|
||||
}
|
||||
|
||||
// resolve the link, then start over
|
||||
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
||||
start();
|
||||
}
|
||||
|
||||
if (cache) cache[original] = p;
|
||||
|
||||
return p;
|
||||
};
|
||||
|
||||
|
||||
exports.realpath = function realpath(p, cache, cb) {
|
||||
if (typeof cb !== 'function') {
|
||||
cb = maybeCallback(cache);
|
||||
cache = null;
|
||||
}
|
||||
|
||||
// make p is absolute
|
||||
p = pathModule.resolve(p);
|
||||
|
||||
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
||||
return process.nextTick(cb.bind(null, null, cache[p]));
|
||||
}
|
||||
|
||||
var original = p,
|
||||
seenLinks = {},
|
||||
knownHard = {};
|
||||
|
||||
// current character position in p
|
||||
var pos;
|
||||
// the partial path so far, including a trailing slash if any
|
||||
var current;
|
||||
// the partial path without a trailing slash (except when pointing at a root)
|
||||
var base;
|
||||
// the partial path scanned in the previous round, with slash
|
||||
var previous;
|
||||
|
||||
start();
|
||||
|
||||
function start() {
|
||||
// Skip over roots
|
||||
var m = splitRootRe.exec(p);
|
||||
pos = m[0].length;
|
||||
current = m[0];
|
||||
base = m[0];
|
||||
previous = '';
|
||||
|
||||
// On windows, check that the root exists. On unix there is no need.
|
||||
if (isWindows && !knownHard[base]) {
|
||||
fs.lstat(base, function(err) {
|
||||
if (err) return cb(err);
|
||||
knownHard[base] = true;
|
||||
LOOP();
|
||||
});
|
||||
} else {
|
||||
process.nextTick(LOOP);
|
||||
}
|
||||
}
|
||||
|
||||
// walk down the path, swapping out linked pathparts for their real
|
||||
// values
|
||||
function LOOP() {
|
||||
// stop if scanned past end of path
|
||||
if (pos >= p.length) {
|
||||
if (cache) cache[original] = p;
|
||||
return cb(null, p);
|
||||
}
|
||||
|
||||
// find the next part
|
||||
nextPartRe.lastIndex = pos;
|
||||
var result = nextPartRe.exec(p);
|
||||
previous = current;
|
||||
current += result[0];
|
||||
base = previous + result[1];
|
||||
pos = nextPartRe.lastIndex;
|
||||
|
||||
// continue if not a symlink
|
||||
if (knownHard[base] || (cache && cache[base] === base)) {
|
||||
return process.nextTick(LOOP);
|
||||
}
|
||||
|
||||
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
||||
// known symbolic link. no need to stat again.
|
||||
return gotResolvedLink(cache[base]);
|
||||
}
|
||||
|
||||
return fs.lstat(base, gotStat);
|
||||
}
|
||||
|
||||
function gotStat(err, stat) {
|
||||
if (err) return cb(err);
|
||||
|
||||
// if not a symlink, skip to the next path part
|
||||
if (!stat.isSymbolicLink()) {
|
||||
knownHard[base] = true;
|
||||
if (cache) cache[base] = base;
|
||||
return process.nextTick(LOOP);
|
||||
}
|
||||
|
||||
// stat & read the link if not read before
|
||||
// call gotTarget as soon as the link target is known
|
||||
// dev/ino always return 0 on windows, so skip the check.
|
||||
if (!isWindows) {
|
||||
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
||||
if (seenLinks.hasOwnProperty(id)) {
|
||||
return gotTarget(null, seenLinks[id], base);
|
||||
}
|
||||
}
|
||||
fs.stat(base, function(err) {
|
||||
if (err) return cb(err);
|
||||
|
||||
fs.readlink(base, function(err, target) {
|
||||
if (!isWindows) seenLinks[id] = target;
|
||||
gotTarget(err, target);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function gotTarget(err, target, base) {
|
||||
if (err) return cb(err);
|
||||
|
||||
var resolvedLink = pathModule.resolve(previous, target);
|
||||
if (cache) cache[base] = resolvedLink;
|
||||
gotResolvedLink(resolvedLink);
|
||||
}
|
||||
|
||||
function gotResolvedLink(resolvedLink) {
|
||||
// resolve the link, then start over
|
||||
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
||||
start();
|
||||
}
|
||||
};
|
94
app/node_modules/fs.realpath/package.json
generated
vendored
Normal file
94
app/node_modules/fs.realpath/package.json
generated
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "fs.realpath@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "fs.realpath",
|
||||
"name": "fs.realpath",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\glob"
|
||||
]
|
||||
],
|
||||
"_from": "fs.realpath@>=1.0.0 <2.0.0",
|
||||
"_id": "fs.realpath@1.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/fs.realpath",
|
||||
"_nodeVersion": "4.4.4",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/fs.realpath-1.0.0.tgz_1466015941059_0.3332864767871797"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.9.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "fs.realpath@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "fs.realpath",
|
||||
"name": "fs.realpath",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/glob"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"_shasum": "1504ad2523158caa40db4a2787cb01411994ea4f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "fs.realpath@^1.0.0",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app\\node_modules\\glob",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/fs.realpath/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "1504ad2523158caa40db4a2787cb01411994ea4f",
|
||||
"tarball": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"old.js",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "03e7c884431fe185dfebbc9b771aeca339c1807a",
|
||||
"homepage": "https://github.com/isaacs/fs.realpath#readme",
|
||||
"keywords": [
|
||||
"realpath",
|
||||
"fs",
|
||||
"polyfill"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"name": "fs.realpath",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/fs.realpath.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
5
app/node_modules/fstream/.npmignore
generated
vendored
Normal file
5
app/node_modules/fstream/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.*.swp
|
||||
node_modules/
|
||||
examples/deep-copy/
|
||||
examples/path/
|
||||
examples/filter-copy/
|
3
app/node_modules/fstream/.travis.yml
generated
vendored
Normal file
3
app/node_modules/fstream/.travis.yml
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
27
app/node_modules/fstream/LICENSE
generated
vendored
Normal file
27
app/node_modules/fstream/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) Isaac Z. Schlueter ("Author")
|
||||
All rights reserved.
|
||||
|
||||
The BSD License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
76
app/node_modules/fstream/README.md
generated
vendored
Normal file
76
app/node_modules/fstream/README.md
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
Like FS streams, but with stat on them, and supporting directories and
|
||||
symbolic links, as well as normal files. Also, you can use this to set
|
||||
the stats on a file, even if you don't change its contents, or to create
|
||||
a symlink, etc.
|
||||
|
||||
So, for example, you can "write" a directory, and it'll call `mkdir`. You
|
||||
can specify a uid and gid, and it'll call `chown`. You can specify a
|
||||
`mtime` and `atime`, and it'll call `utimes`. You can call it a symlink
|
||||
and provide a `linkpath` and it'll call `symlink`.
|
||||
|
||||
Note that it won't automatically resolve symbolic links. So, if you
|
||||
call `fstream.Reader('/some/symlink')` then you'll get an object
|
||||
that stats and then ends immediately (since it has no data). To follow
|
||||
symbolic links, do this: `fstream.Reader({path:'/some/symlink', follow:
|
||||
true })`.
|
||||
|
||||
There are various checks to make sure that the bytes emitted are the
|
||||
same as the intended size, if the size is set.
|
||||
|
||||
## Examples
|
||||
|
||||
```javascript
|
||||
fstream
|
||||
.Writer({ path: "path/to/file"
|
||||
, mode: 0755
|
||||
, size: 6
|
||||
})
|
||||
.write("hello\n")
|
||||
.end()
|
||||
```
|
||||
|
||||
This will create the directories if they're missing, and then write
|
||||
`hello\n` into the file, chmod it to 0755, and assert that 6 bytes have
|
||||
been written when it's done.
|
||||
|
||||
```javascript
|
||||
fstream
|
||||
.Writer({ path: "path/to/file"
|
||||
, mode: 0755
|
||||
, size: 6
|
||||
, flags: "a"
|
||||
})
|
||||
.write("hello\n")
|
||||
.end()
|
||||
```
|
||||
|
||||
You can pass flags in, if you want to append to a file.
|
||||
|
||||
```javascript
|
||||
fstream
|
||||
.Writer({ path: "path/to/symlink"
|
||||
, linkpath: "./file"
|
||||
, SymbolicLink: true
|
||||
, mode: "0755" // octal strings supported
|
||||
})
|
||||
.end()
|
||||
```
|
||||
|
||||
If isSymbolicLink is a function, it'll be called, and if it returns
|
||||
true, then it'll treat it as a symlink. If it's not a function, then
|
||||
any truish value will make a symlink, or you can set `type:
|
||||
'SymbolicLink'`, which does the same thing.
|
||||
|
||||
Note that the linkpath is relative to the symbolic link location, not
|
||||
the parent dir or cwd.
|
||||
|
||||
```javascript
|
||||
fstream
|
||||
.Reader("path/to/dir")
|
||||
.pipe(fstream.Writer("path/to/other/dir"))
|
||||
```
|
||||
|
||||
This will do like `cp -Rp path/to/dir path/to/other/dir`. If the other
|
||||
dir exists and isn't a directory, then it'll emit an error. It'll also
|
||||
set the uid, gid, mode, etc. to be identical. In this way, it's more
|
||||
like `rsync -a` than simply a copy.
|
131
app/node_modules/fstream/examples/filter-pipe.js
generated
vendored
Normal file
131
app/node_modules/fstream/examples/filter-pipe.js
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
var fstream = require("../fstream.js")
|
||||
var path = require("path")
|
||||
|
||||
var r = fstream.Reader({ path: path.dirname(__dirname)
|
||||
, filter: function () {
|
||||
return !this.basename.match(/^\./) &&
|
||||
!this.basename.match(/^node_modules$/)
|
||||
!this.basename.match(/^deep-copy$/)
|
||||
!this.basename.match(/^filter-copy$/)
|
||||
}
|
||||
})
|
||||
|
||||
// this writer will only write directories
|
||||
var w = fstream.Writer({ path: path.resolve(__dirname, "filter-copy")
|
||||
, type: "Directory"
|
||||
, filter: function () {
|
||||
return this.type === "Directory"
|
||||
}
|
||||
})
|
||||
|
||||
var indent = ""
|
||||
var escape = {}
|
||||
|
||||
r.on("entry", appears)
|
||||
r.on("ready", function () {
|
||||
console.error("ready to begin!", r.path)
|
||||
})
|
||||
|
||||
function appears (entry) {
|
||||
console.error(indent + "a %s appears!", entry.type, entry.basename, typeof entry.basename)
|
||||
if (foggy) {
|
||||
console.error("FOGGY!")
|
||||
var p = entry
|
||||
do {
|
||||
console.error(p.depth, p.path, p._paused)
|
||||
} while (p = p.parent)
|
||||
|
||||
throw new Error("\033[mshould not have entries while foggy")
|
||||
}
|
||||
indent += "\t"
|
||||
entry.on("data", missile(entry))
|
||||
entry.on("end", runaway(entry))
|
||||
entry.on("entry", appears)
|
||||
}
|
||||
|
||||
var foggy
|
||||
function missile (entry) {
|
||||
if (entry.type === "Directory") {
|
||||
var ended = false
|
||||
entry.once("end", function () { ended = true })
|
||||
return function (c) {
|
||||
// throw in some pathological pause()/resume() behavior
|
||||
// just for extra fun.
|
||||
process.nextTick(function () {
|
||||
if (!foggy && !ended) { // && Math.random() < 0.3) {
|
||||
console.error(indent +"%s casts a spell", entry.basename)
|
||||
console.error("\na slowing fog comes over the battlefield...\n\033[32m")
|
||||
entry.pause()
|
||||
entry.once("resume", liftFog)
|
||||
foggy = setTimeout(liftFog, 1000)
|
||||
|
||||
function liftFog (who) {
|
||||
if (!foggy) return
|
||||
if (who) {
|
||||
console.error("%s breaks the spell!", who && who.path)
|
||||
} else {
|
||||
console.error("the spell expires!")
|
||||
}
|
||||
console.error("\033[mthe fog lifts!\n")
|
||||
clearTimeout(foggy)
|
||||
foggy = null
|
||||
if (entry._paused) entry.resume()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return function (c) {
|
||||
var e = Math.random() < 0.5
|
||||
console.error(indent + "%s %s for %d damage!",
|
||||
entry.basename,
|
||||
e ? "is struck" : "fires a chunk",
|
||||
c.length)
|
||||
}
|
||||
}
|
||||
|
||||
function runaway (entry) { return function () {
|
||||
var e = Math.random() < 0.5
|
||||
console.error(indent + "%s %s",
|
||||
entry.basename,
|
||||
e ? "turns to flee" : "is vanquished!")
|
||||
indent = indent.slice(0, -1)
|
||||
}}
|
||||
|
||||
|
||||
w.on("entry", attacks)
|
||||
//w.on("ready", function () { attacks(w) })
|
||||
function attacks (entry) {
|
||||
console.error(indent + "%s %s!", entry.basename,
|
||||
entry.type === "Directory" ? "calls for backup" : "attacks")
|
||||
entry.on("entry", attacks)
|
||||
}
|
||||
|
||||
ended = false
|
||||
var i = 1
|
||||
r.on("end", function () {
|
||||
if (foggy) clearTimeout(foggy)
|
||||
console.error("\033[mIT'S OVER!!")
|
||||
console.error("A WINNAR IS YOU!")
|
||||
|
||||
console.log("ok " + (i ++) + " A WINNAR IS YOU")
|
||||
ended = true
|
||||
// now go through and verify that everything in there is a dir.
|
||||
var p = path.resolve(__dirname, "filter-copy")
|
||||
var checker = fstream.Reader({ path: p })
|
||||
checker.checker = true
|
||||
checker.on("child", function (e) {
|
||||
var ok = e.type === "Directory"
|
||||
console.log((ok ? "" : "not ") + "ok " + (i ++) +
|
||||
" should be a dir: " +
|
||||
e.path.substr(checker.path.length + 1))
|
||||
})
|
||||
})
|
||||
|
||||
process.on("exit", function () {
|
||||
console.log((ended ? "" : "not ") + "ok " + (i ++) + " ended")
|
||||
})
|
||||
|
||||
r.pipe(w)
|
115
app/node_modules/fstream/examples/pipe.js
generated
vendored
Normal file
115
app/node_modules/fstream/examples/pipe.js
generated
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
var fstream = require("../fstream.js")
|
||||
var path = require("path")
|
||||
|
||||
var r = fstream.Reader({ path: path.dirname(__dirname)
|
||||
, filter: function () {
|
||||
return !this.basename.match(/^\./) &&
|
||||
!this.basename.match(/^node_modules$/)
|
||||
!this.basename.match(/^deep-copy$/)
|
||||
}
|
||||
})
|
||||
|
||||
var w = fstream.Writer({ path: path.resolve(__dirname, "deep-copy")
|
||||
, type: "Directory"
|
||||
})
|
||||
|
||||
var indent = ""
|
||||
var escape = {}
|
||||
|
||||
r.on("entry", appears)
|
||||
r.on("ready", function () {
|
||||
console.error("ready to begin!", r.path)
|
||||
})
|
||||
|
||||
function appears (entry) {
|
||||
console.error(indent + "a %s appears!", entry.type, entry.basename, typeof entry.basename, entry)
|
||||
if (foggy) {
|
||||
console.error("FOGGY!")
|
||||
var p = entry
|
||||
do {
|
||||
console.error(p.depth, p.path, p._paused)
|
||||
} while (p = p.parent)
|
||||
|
||||
throw new Error("\033[mshould not have entries while foggy")
|
||||
}
|
||||
indent += "\t"
|
||||
entry.on("data", missile(entry))
|
||||
entry.on("end", runaway(entry))
|
||||
entry.on("entry", appears)
|
||||
}
|
||||
|
||||
var foggy
|
||||
function missile (entry) {
|
||||
if (entry.type === "Directory") {
|
||||
var ended = false
|
||||
entry.once("end", function () { ended = true })
|
||||
return function (c) {
|
||||
// throw in some pathological pause()/resume() behavior
|
||||
// just for extra fun.
|
||||
process.nextTick(function () {
|
||||
if (!foggy && !ended) { // && Math.random() < 0.3) {
|
||||
console.error(indent +"%s casts a spell", entry.basename)
|
||||
console.error("\na slowing fog comes over the battlefield...\n\033[32m")
|
||||
entry.pause()
|
||||
entry.once("resume", liftFog)
|
||||
foggy = setTimeout(liftFog, 10)
|
||||
|
||||
function liftFog (who) {
|
||||
if (!foggy) return
|
||||
if (who) {
|
||||
console.error("%s breaks the spell!", who && who.path)
|
||||
} else {
|
||||
console.error("the spell expires!")
|
||||
}
|
||||
console.error("\033[mthe fog lifts!\n")
|
||||
clearTimeout(foggy)
|
||||
foggy = null
|
||||
if (entry._paused) entry.resume()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return function (c) {
|
||||
var e = Math.random() < 0.5
|
||||
console.error(indent + "%s %s for %d damage!",
|
||||
entry.basename,
|
||||
e ? "is struck" : "fires a chunk",
|
||||
c.length)
|
||||
}
|
||||
}
|
||||
|
||||
function runaway (entry) { return function () {
|
||||
var e = Math.random() < 0.5
|
||||
console.error(indent + "%s %s",
|
||||
entry.basename,
|
||||
e ? "turns to flee" : "is vanquished!")
|
||||
indent = indent.slice(0, -1)
|
||||
}}
|
||||
|
||||
|
||||
w.on("entry", attacks)
|
||||
//w.on("ready", function () { attacks(w) })
|
||||
function attacks (entry) {
|
||||
console.error(indent + "%s %s!", entry.basename,
|
||||
entry.type === "Directory" ? "calls for backup" : "attacks")
|
||||
entry.on("entry", attacks)
|
||||
}
|
||||
|
||||
ended = false
|
||||
r.on("end", function () {
|
||||
if (foggy) clearTimeout(foggy)
|
||||
console.error("\033[mIT'S OVER!!")
|
||||
console.error("A WINNAR IS YOU!")
|
||||
|
||||
console.log("ok 1 A WINNAR IS YOU")
|
||||
ended = true
|
||||
})
|
||||
|
||||
process.on("exit", function () {
|
||||
console.log((ended ? "" : "not ") + "ok 2 ended")
|
||||
})
|
||||
|
||||
r.pipe(w)
|
54
app/node_modules/fstream/examples/reader.js
generated
vendored
Normal file
54
app/node_modules/fstream/examples/reader.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
var fstream = require("../fstream.js")
|
||||
var tap = require("tap")
|
||||
var fs = require("fs")
|
||||
var path = require("path")
|
||||
var children = -1
|
||||
var dir = path.dirname(__dirname)
|
||||
|
||||
var gotReady = false
|
||||
var ended = false
|
||||
|
||||
tap.test("reader test", function (t) {
|
||||
|
||||
var r = fstream.Reader({ path: dir
|
||||
, filter: function () {
|
||||
// return this.parent === r
|
||||
return this.parent === r || this === r
|
||||
}
|
||||
})
|
||||
|
||||
r.on("ready", function () {
|
||||
gotReady = true
|
||||
children = fs.readdirSync(dir).length
|
||||
console.error("Setting expected children to "+children)
|
||||
t.equal(r.type, "Directory", "should be a directory")
|
||||
})
|
||||
|
||||
r.on("entry", function (entry) {
|
||||
children --
|
||||
if (!gotReady) {
|
||||
t.fail("children before ready!")
|
||||
}
|
||||
t.equal(entry.dirname, r.path, "basename is parent dir")
|
||||
})
|
||||
|
||||
r.on("error", function (er) {
|
||||
t.fail(er)
|
||||
t.end()
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
r.on("end", function () {
|
||||
t.equal(children, 0, "should have seen all children")
|
||||
ended = true
|
||||
})
|
||||
|
||||
var closed = false
|
||||
r.on("close", function () {
|
||||
t.ok(ended, "saw end before close")
|
||||
t.notOk(closed, "close should only happen once")
|
||||
closed = true
|
||||
t.end()
|
||||
})
|
||||
|
||||
})
|
24
app/node_modules/fstream/examples/symlink-write.js
generated
vendored
Normal file
24
app/node_modules/fstream/examples/symlink-write.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
var fstream = require("../fstream.js")
|
||||
, closed = false
|
||||
|
||||
fstream
|
||||
.Writer({ path: "path/to/symlink"
|
||||
, linkpath: "./file"
|
||||
, isSymbolicLink: true
|
||||
, mode: "0755" // octal strings supported
|
||||
})
|
||||
.on("close", function () {
|
||||
closed = true
|
||||
var fs = require("fs")
|
||||
var s = fs.lstatSync("path/to/symlink")
|
||||
var isSym = s.isSymbolicLink()
|
||||
console.log((isSym?"":"not ") +"ok 1 should be symlink")
|
||||
var t = fs.readlinkSync("path/to/symlink")
|
||||
var isTarget = t === "./file"
|
||||
console.log((isTarget?"":"not ") +"ok 2 should link to ./file")
|
||||
})
|
||||
.end()
|
||||
|
||||
process.on("exit", function () {
|
||||
console.log((closed?"":"not ")+"ok 3 should be closed")
|
||||
})
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user