mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
update dependencies
Includes patch from @TimothyGu to rhino/os.js and rhino/rhino-shim.js.
This commit is contained in:
parent
72783fc017
commit
a2ce6a79ad
2
node_modules/async/LICENSE
generated
vendored
2
node_modules/async/LICENSE
generated
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2010 Caolan McMahon
|
||||
Copyright (c) 2010-2014 Caolan McMahon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
3
node_modules/async/index.js
generated
vendored
3
node_modules/async/index.js
generated
vendored
@ -1,3 +0,0 @@
|
||||
// This file is just added for convenience so this repository can be
|
||||
// directly checked out into a project's deps folder
|
||||
module.exports = require('./lib/async');
|
||||
657
node_modules/async/lib/async.js
generated
vendored
Normal file → Executable file
657
node_modules/async/lib/async.js
generated
vendored
Normal file → Executable file
@ -1,17 +1,22 @@
|
||||
/*global setTimeout: false, console: false */
|
||||
/*!
|
||||
* async
|
||||
* https://github.com/caolan/async
|
||||
*
|
||||
* Copyright 2010-2014 Caolan McMahon
|
||||
* Released under the MIT license
|
||||
*/
|
||||
/*jshint onevar: false, indent:4 */
|
||||
/*global setImmediate: false, setTimeout: false, console: false */
|
||||
(function () {
|
||||
|
||||
var async = {};
|
||||
|
||||
// global on the server, window in the browser
|
||||
var root = this,
|
||||
previous_async = root.async;
|
||||
var root, previous_async;
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = async;
|
||||
}
|
||||
else {
|
||||
root.async = async;
|
||||
root = this;
|
||||
if (root != null) {
|
||||
previous_async = root.async;
|
||||
}
|
||||
|
||||
async.noConflict = function () {
|
||||
@ -19,9 +24,24 @@
|
||||
return async;
|
||||
};
|
||||
|
||||
function only_once(fn) {
|
||||
var called = false;
|
||||
return function() {
|
||||
if (called) throw new Error("Callback was already called.");
|
||||
called = true;
|
||||
fn.apply(root, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
//// cross-browser compatiblity functions ////
|
||||
|
||||
var _forEach = function (arr, iterator) {
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
var _isArray = Array.isArray || function (obj) {
|
||||
return _toString.call(obj) === '[object Array]';
|
||||
};
|
||||
|
||||
var _each = function (arr, iterator) {
|
||||
if (arr.forEach) {
|
||||
return arr.forEach(iterator);
|
||||
}
|
||||
@ -35,7 +55,7 @@
|
||||
return arr.map(iterator);
|
||||
}
|
||||
var results = [];
|
||||
_forEach(arr, function (x, i, a) {
|
||||
_each(arr, function (x, i, a) {
|
||||
results.push(iterator(x, i, a));
|
||||
});
|
||||
return results;
|
||||
@ -45,7 +65,7 @@
|
||||
if (arr.reduce) {
|
||||
return arr.reduce(iterator, memo);
|
||||
}
|
||||
_forEach(arr, function (x, i, a) {
|
||||
_each(arr, function (x, i, a) {
|
||||
memo = iterator(memo, x, i, a);
|
||||
});
|
||||
return memo;
|
||||
@ -68,37 +88,58 @@
|
||||
|
||||
//// nextTick implementation with browser-compatible fallback ////
|
||||
if (typeof process === 'undefined' || !(process.nextTick)) {
|
||||
async.nextTick = function (fn) {
|
||||
setTimeout(fn, 0);
|
||||
};
|
||||
if (typeof setImmediate === 'function') {
|
||||
async.nextTick = function (fn) {
|
||||
// not a direct alias for IE10 compatibility
|
||||
setImmediate(fn);
|
||||
};
|
||||
async.setImmediate = async.nextTick;
|
||||
}
|
||||
else {
|
||||
async.nextTick = function (fn) {
|
||||
setTimeout(fn, 0);
|
||||
};
|
||||
async.setImmediate = async.nextTick;
|
||||
}
|
||||
}
|
||||
else {
|
||||
async.nextTick = process.nextTick;
|
||||
if (typeof setImmediate !== 'undefined') {
|
||||
async.setImmediate = function (fn) {
|
||||
// not a direct alias for IE10 compatibility
|
||||
setImmediate(fn);
|
||||
};
|
||||
}
|
||||
else {
|
||||
async.setImmediate = async.nextTick;
|
||||
}
|
||||
}
|
||||
|
||||
async.forEach = function (arr, iterator, callback) {
|
||||
async.each = function (arr, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length) {
|
||||
return callback();
|
||||
}
|
||||
var completed = 0;
|
||||
_forEach(arr, function (x) {
|
||||
iterator(x, function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
if (completed === arr.length) {
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
_each(arr, function (x) {
|
||||
iterator(x, only_once(done) );
|
||||
});
|
||||
function done(err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
if (completed >= arr.length) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
async.forEach = async.each;
|
||||
|
||||
async.forEachSeries = function (arr, iterator, callback) {
|
||||
async.eachSeries = function (arr, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length) {
|
||||
return callback();
|
||||
@ -112,8 +153,8 @@
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
if (completed === arr.length) {
|
||||
callback(null);
|
||||
if (completed >= arr.length) {
|
||||
callback();
|
||||
}
|
||||
else {
|
||||
iterate();
|
||||
@ -123,81 +164,111 @@
|
||||
};
|
||||
iterate();
|
||||
};
|
||||
async.forEachSeries = async.eachSeries;
|
||||
|
||||
async.forEachLimit = function (arr, limit, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length || limit <= 0) {
|
||||
return callback();
|
||||
}
|
||||
var completed = 0;
|
||||
var started = 0;
|
||||
var running = 0;
|
||||
async.eachLimit = function (arr, limit, iterator, callback) {
|
||||
var fn = _eachLimit(limit);
|
||||
fn.apply(null, [arr, iterator, callback]);
|
||||
};
|
||||
async.forEachLimit = async.eachLimit;
|
||||
|
||||
(function replenish () {
|
||||
if (completed === arr.length) {
|
||||
var _eachLimit = function (limit) {
|
||||
|
||||
return function (arr, iterator, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!arr.length || limit <= 0) {
|
||||
return callback();
|
||||
}
|
||||
var completed = 0;
|
||||
var started = 0;
|
||||
var running = 0;
|
||||
|
||||
while (running < limit && started < arr.length) {
|
||||
started += 1;
|
||||
running += 1;
|
||||
iterator(arr[started - 1], function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
completed += 1;
|
||||
running -= 1;
|
||||
if (completed === arr.length) {
|
||||
callback();
|
||||
(function replenish () {
|
||||
if (completed >= arr.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
while (running < limit && started < arr.length) {
|
||||
started += 1;
|
||||
running += 1;
|
||||
iterator(arr[started - 1], function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
replenish();
|
||||
completed += 1;
|
||||
running -= 1;
|
||||
if (completed >= arr.length) {
|
||||
callback();
|
||||
}
|
||||
else {
|
||||
replenish();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
});
|
||||
}
|
||||
})();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var doParallel = function (fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return fn.apply(null, [async.forEach].concat(args));
|
||||
return fn.apply(null, [async.each].concat(args));
|
||||
};
|
||||
};
|
||||
var doParallelLimit = function(limit, fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return fn.apply(null, [_eachLimit(limit)].concat(args));
|
||||
};
|
||||
};
|
||||
var doSeries = function (fn) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
return fn.apply(null, [async.forEachSeries].concat(args));
|
||||
return fn.apply(null, [async.eachSeries].concat(args));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
var _asyncMap = function (eachfn, arr, iterator, callback) {
|
||||
var results = [];
|
||||
arr = _map(arr, function (x, i) {
|
||||
return {index: i, value: x};
|
||||
});
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x.value, function (err, v) {
|
||||
results[x.index] = v;
|
||||
callback(err);
|
||||
if (!callback) {
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x.value, function (err) {
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, results);
|
||||
});
|
||||
} else {
|
||||
var results = [];
|
||||
eachfn(arr, function (x, callback) {
|
||||
iterator(x.value, function (err, v) {
|
||||
results[x.index] = v;
|
||||
callback(err);
|
||||
});
|
||||
}, function (err) {
|
||||
callback(err, results);
|
||||
});
|
||||
}
|
||||
};
|
||||
async.map = doParallel(_asyncMap);
|
||||
async.mapSeries = doSeries(_asyncMap);
|
||||
async.mapLimit = function (arr, limit, iterator, callback) {
|
||||
return _mapLimit(limit)(arr, iterator, callback);
|
||||
};
|
||||
|
||||
var _mapLimit = function(limit) {
|
||||
return doParallelLimit(limit, _asyncMap);
|
||||
};
|
||||
|
||||
// reduce only has a series version, as doing reduce in parallel won't
|
||||
// work in many situations.
|
||||
async.reduce = function (arr, memo, iterator, callback) {
|
||||
async.forEachSeries(arr, function (x, callback) {
|
||||
async.eachSeries(arr, function (x, callback) {
|
||||
iterator(memo, x, function (err, v) {
|
||||
memo = v;
|
||||
callback(err);
|
||||
@ -288,7 +359,7 @@
|
||||
async.detectSeries = doSeries(_detect);
|
||||
|
||||
async.some = function (arr, iterator, main_callback) {
|
||||
async.forEach(arr, function (x, callback) {
|
||||
async.each(arr, function (x, callback) {
|
||||
iterator(x, function (v) {
|
||||
if (v) {
|
||||
main_callback(true);
|
||||
@ -304,7 +375,7 @@
|
||||
async.any = async.some;
|
||||
|
||||
async.every = function (arr, iterator, main_callback) {
|
||||
async.forEach(arr, function (x, callback) {
|
||||
async.each(arr, function (x, callback) {
|
||||
iterator(x, function (v) {
|
||||
if (!v) {
|
||||
main_callback(false);
|
||||
@ -348,8 +419,9 @@
|
||||
async.auto = function (tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
var keys = _keys(tasks);
|
||||
if (!keys.length) {
|
||||
return callback(null);
|
||||
var remainingTasks = keys.length
|
||||
if (!remainingTasks) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
var results = {};
|
||||
@ -367,33 +439,42 @@
|
||||
}
|
||||
};
|
||||
var taskComplete = function () {
|
||||
_forEach(listeners.slice(0), function (fn) {
|
||||
remainingTasks--
|
||||
_each(listeners.slice(0), function (fn) {
|
||||
fn();
|
||||
});
|
||||
};
|
||||
|
||||
addListener(function () {
|
||||
if (_keys(results).length === keys.length) {
|
||||
callback(null, results);
|
||||
if (!remainingTasks) {
|
||||
var theCallback = callback;
|
||||
// prevent final callback from calling itself if it errors
|
||||
callback = function () {};
|
||||
|
||||
theCallback(null, results);
|
||||
}
|
||||
});
|
||||
|
||||
_forEach(keys, function (k) {
|
||||
var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
|
||||
_each(keys, function (k) {
|
||||
var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
|
||||
var taskCallback = function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
if (err) {
|
||||
callback(err);
|
||||
var safeResults = {};
|
||||
_each(_keys(results), function(rkey) {
|
||||
safeResults[rkey] = results[rkey];
|
||||
});
|
||||
safeResults[k] = args;
|
||||
callback(err, safeResults);
|
||||
// stop subsequent errors hitting callback multiple times
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
args = args[0];
|
||||
}
|
||||
results[k] = args;
|
||||
taskComplete();
|
||||
async.setImmediate(taskComplete);
|
||||
}
|
||||
};
|
||||
var requires = task.slice(0, Math.abs(task.length - 1)) || [];
|
||||
@ -417,15 +498,50 @@
|
||||
});
|
||||
};
|
||||
|
||||
async.retry = function(times, task, callback) {
|
||||
var DEFAULT_TIMES = 5;
|
||||
var attempts = [];
|
||||
// Use defaults if times not passed
|
||||
if (typeof times === 'function') {
|
||||
callback = task;
|
||||
task = times;
|
||||
times = DEFAULT_TIMES;
|
||||
}
|
||||
// Make sure times is a number
|
||||
times = parseInt(times, 10) || DEFAULT_TIMES;
|
||||
var wrappedTask = function(wrappedCallback, wrappedResults) {
|
||||
var retryAttempt = function(task, finalAttempt) {
|
||||
return function(seriesCallback) {
|
||||
task(function(err, result){
|
||||
seriesCallback(!err || finalAttempt, {err: err, result: result});
|
||||
}, wrappedResults);
|
||||
};
|
||||
};
|
||||
while (times) {
|
||||
attempts.push(retryAttempt(task, !(times-=1)));
|
||||
}
|
||||
async.series(attempts, function(done, data){
|
||||
data = data[data.length - 1];
|
||||
(wrappedCallback || callback)(data.err, data.result);
|
||||
});
|
||||
}
|
||||
// If a callback is passed, run this as a controll flow
|
||||
return callback ? wrappedTask() : wrappedTask
|
||||
};
|
||||
|
||||
async.waterfall = function (tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
if (!_isArray(tasks)) {
|
||||
var err = new Error('First argument to waterfall must be an array of functions');
|
||||
return callback(err);
|
||||
}
|
||||
if (!tasks.length) {
|
||||
return callback();
|
||||
}
|
||||
var wrapIterator = function (iterator) {
|
||||
return function (err) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
callback.apply(null, arguments);
|
||||
callback = function () {};
|
||||
}
|
||||
else {
|
||||
@ -437,7 +553,7 @@
|
||||
else {
|
||||
args.push(callback);
|
||||
}
|
||||
async.nextTick(function () {
|
||||
async.setImmediate(function () {
|
||||
iterator.apply(null, args);
|
||||
});
|
||||
}
|
||||
@ -446,10 +562,10 @@
|
||||
wrapIterator(async.iterator(tasks))();
|
||||
};
|
||||
|
||||
async.parallel = function (tasks, callback) {
|
||||
var _parallel = function(eachfn, tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
if (tasks.constructor === Array) {
|
||||
async.map(tasks, function (fn, callback) {
|
||||
if (_isArray(tasks)) {
|
||||
eachfn.map(tasks, function (fn, callback) {
|
||||
if (fn) {
|
||||
fn(function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
@ -463,7 +579,7 @@
|
||||
}
|
||||
else {
|
||||
var results = {};
|
||||
async.forEach(_keys(tasks), function (k, callback) {
|
||||
eachfn.each(_keys(tasks), function (k, callback) {
|
||||
tasks[k](function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
@ -478,9 +594,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
async.parallel = function (tasks, callback) {
|
||||
_parallel({ map: async.map, each: async.each }, tasks, callback);
|
||||
};
|
||||
|
||||
async.parallelLimit = function(tasks, limit, callback) {
|
||||
_parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
|
||||
};
|
||||
|
||||
async.series = function (tasks, callback) {
|
||||
callback = callback || function () {};
|
||||
if (tasks.constructor === Array) {
|
||||
if (_isArray(tasks)) {
|
||||
async.mapSeries(tasks, function (fn, callback) {
|
||||
if (fn) {
|
||||
fn(function (err) {
|
||||
@ -495,7 +619,7 @@
|
||||
}
|
||||
else {
|
||||
var results = {};
|
||||
async.forEachSeries(_keys(tasks), function (k, callback) {
|
||||
async.eachSeries(_keys(tasks), function (k, callback) {
|
||||
tasks[k](function (err) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (args.length <= 1) {
|
||||
@ -563,6 +687,21 @@
|
||||
}
|
||||
};
|
||||
|
||||
async.doWhilst = function (iterator, test, callback) {
|
||||
iterator(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (test.apply(null, args)) {
|
||||
async.doWhilst(iterator, test, callback);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async.until = function (test, iterator, callback) {
|
||||
if (!test()) {
|
||||
iterator(function (err) {
|
||||
@ -577,7 +716,59 @@
|
||||
}
|
||||
};
|
||||
|
||||
async.doUntil = function (iterator, test, callback) {
|
||||
iterator(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
if (!test.apply(null, args)) {
|
||||
async.doUntil(iterator, test, callback);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async.queue = function (worker, concurrency) {
|
||||
if (concurrency === undefined) {
|
||||
concurrency = 1;
|
||||
}
|
||||
function _insert(q, data, pos, callback) {
|
||||
if (!q.started){
|
||||
q.started = true;
|
||||
}
|
||||
if (!_isArray(data)) {
|
||||
data = [data];
|
||||
}
|
||||
if(data.length == 0) {
|
||||
// call drain immediately if there are no tasks
|
||||
return async.setImmediate(function() {
|
||||
if (q.drain) {
|
||||
q.drain();
|
||||
}
|
||||
});
|
||||
}
|
||||
_each(data, function(task) {
|
||||
var item = {
|
||||
data: task,
|
||||
callback: typeof callback === 'function' ? callback : null
|
||||
};
|
||||
|
||||
if (pos) {
|
||||
q.tasks.unshift(item);
|
||||
} else {
|
||||
q.tasks.push(item);
|
||||
}
|
||||
|
||||
if (q.saturated && q.tasks.length === q.concurrency) {
|
||||
q.saturated();
|
||||
}
|
||||
async.setImmediate(q.process);
|
||||
});
|
||||
}
|
||||
|
||||
var workers = 0;
|
||||
var q = {
|
||||
tasks: [],
|
||||
@ -585,34 +776,37 @@
|
||||
saturated: null,
|
||||
empty: null,
|
||||
drain: null,
|
||||
started: false,
|
||||
paused: false,
|
||||
push: function (data, callback) {
|
||||
if(data.constructor !== Array) {
|
||||
data = [data];
|
||||
}
|
||||
_forEach(data, function(task) {
|
||||
q.tasks.push({
|
||||
data: task,
|
||||
callback: typeof callback === 'function' ? callback : null
|
||||
});
|
||||
if (q.saturated && q.tasks.length == concurrency) {
|
||||
q.saturated();
|
||||
}
|
||||
async.nextTick(q.process);
|
||||
});
|
||||
_insert(q, data, false, callback);
|
||||
},
|
||||
kill: function () {
|
||||
q.drain = null;
|
||||
q.tasks = [];
|
||||
},
|
||||
unshift: function (data, callback) {
|
||||
_insert(q, data, true, callback);
|
||||
},
|
||||
process: function () {
|
||||
if (workers < q.concurrency && q.tasks.length) {
|
||||
if (!q.paused && workers < q.concurrency && q.tasks.length) {
|
||||
var task = q.tasks.shift();
|
||||
if(q.empty && q.tasks.length == 0) q.empty();
|
||||
if (q.empty && q.tasks.length === 0) {
|
||||
q.empty();
|
||||
}
|
||||
workers += 1;
|
||||
worker(task.data, function () {
|
||||
var next = function () {
|
||||
workers -= 1;
|
||||
if (task.callback) {
|
||||
task.callback.apply(task, arguments);
|
||||
}
|
||||
if(q.drain && q.tasks.length + workers == 0) q.drain();
|
||||
if (q.drain && q.tasks.length + workers === 0) {
|
||||
q.drain();
|
||||
}
|
||||
q.process();
|
||||
});
|
||||
};
|
||||
var cb = only_once(next);
|
||||
worker(task.data, cb);
|
||||
}
|
||||
},
|
||||
length: function () {
|
||||
@ -620,10 +814,156 @@
|
||||
},
|
||||
running: function () {
|
||||
return workers;
|
||||
},
|
||||
idle: function() {
|
||||
return q.tasks.length + workers === 0;
|
||||
},
|
||||
pause: function () {
|
||||
if (q.paused === true) { return; }
|
||||
q.paused = true;
|
||||
q.process();
|
||||
},
|
||||
resume: function () {
|
||||
if (q.paused === false) { return; }
|
||||
q.paused = false;
|
||||
q.process();
|
||||
}
|
||||
};
|
||||
return q;
|
||||
};
|
||||
|
||||
async.priorityQueue = function (worker, concurrency) {
|
||||
|
||||
function _compareTasks(a, b){
|
||||
return a.priority - b.priority;
|
||||
};
|
||||
|
||||
function _binarySearch(sequence, item, compare) {
|
||||
var beg = -1,
|
||||
end = sequence.length - 1;
|
||||
while (beg < end) {
|
||||
var mid = beg + ((end - beg + 1) >>> 1);
|
||||
if (compare(item, sequence[mid]) >= 0) {
|
||||
beg = mid;
|
||||
} else {
|
||||
end = mid - 1;
|
||||
}
|
||||
}
|
||||
return beg;
|
||||
}
|
||||
|
||||
function _insert(q, data, priority, callback) {
|
||||
if (!q.started){
|
||||
q.started = true;
|
||||
}
|
||||
if (!_isArray(data)) {
|
||||
data = [data];
|
||||
}
|
||||
if(data.length == 0) {
|
||||
// call drain immediately if there are no tasks
|
||||
return async.setImmediate(function() {
|
||||
if (q.drain) {
|
||||
q.drain();
|
||||
}
|
||||
});
|
||||
}
|
||||
_each(data, function(task) {
|
||||
var item = {
|
||||
data: task,
|
||||
priority: priority,
|
||||
callback: typeof callback === 'function' ? callback : null
|
||||
};
|
||||
|
||||
q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
|
||||
|
||||
if (q.saturated && q.tasks.length === q.concurrency) {
|
||||
q.saturated();
|
||||
}
|
||||
async.setImmediate(q.process);
|
||||
});
|
||||
}
|
||||
|
||||
// Start with a normal queue
|
||||
var q = async.queue(worker, concurrency);
|
||||
|
||||
// Override push to accept second parameter representing priority
|
||||
q.push = function (data, priority, callback) {
|
||||
_insert(q, data, priority, callback);
|
||||
};
|
||||
|
||||
// Remove unshift function
|
||||
delete q.unshift;
|
||||
|
||||
return q;
|
||||
};
|
||||
|
||||
async.cargo = function (worker, payload) {
|
||||
var working = false,
|
||||
tasks = [];
|
||||
|
||||
var cargo = {
|
||||
tasks: tasks,
|
||||
payload: payload,
|
||||
saturated: null,
|
||||
empty: null,
|
||||
drain: null,
|
||||
drained: true,
|
||||
push: function (data, callback) {
|
||||
if (!_isArray(data)) {
|
||||
data = [data];
|
||||
}
|
||||
_each(data, function(task) {
|
||||
tasks.push({
|
||||
data: task,
|
||||
callback: typeof callback === 'function' ? callback : null
|
||||
});
|
||||
cargo.drained = false;
|
||||
if (cargo.saturated && tasks.length === payload) {
|
||||
cargo.saturated();
|
||||
}
|
||||
});
|
||||
async.setImmediate(cargo.process);
|
||||
},
|
||||
process: function process() {
|
||||
if (working) return;
|
||||
if (tasks.length === 0) {
|
||||
if(cargo.drain && !cargo.drained) cargo.drain();
|
||||
cargo.drained = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var ts = typeof payload === 'number'
|
||||
? tasks.splice(0, payload)
|
||||
: tasks.splice(0, tasks.length);
|
||||
|
||||
var ds = _map(ts, function (task) {
|
||||
return task.data;
|
||||
});
|
||||
|
||||
if(cargo.empty) cargo.empty();
|
||||
working = true;
|
||||
worker(ds, function () {
|
||||
working = false;
|
||||
|
||||
var args = arguments;
|
||||
_each(ts, function (data) {
|
||||
if (data.callback) {
|
||||
data.callback.apply(null, args);
|
||||
}
|
||||
});
|
||||
|
||||
process();
|
||||
});
|
||||
},
|
||||
length: function () {
|
||||
return tasks.length;
|
||||
},
|
||||
running: function () {
|
||||
return working;
|
||||
}
|
||||
};
|
||||
return cargo;
|
||||
};
|
||||
|
||||
var _console_fn = function (name) {
|
||||
return function (fn) {
|
||||
@ -637,7 +977,7 @@
|
||||
}
|
||||
}
|
||||
else if (console[name]) {
|
||||
_forEach(args, function (x) {
|
||||
_each(args, function (x) {
|
||||
console[name](x);
|
||||
});
|
||||
}
|
||||
@ -662,7 +1002,9 @@
|
||||
var callback = args.pop();
|
||||
var key = hasher.apply(null, args);
|
||||
if (key in memo) {
|
||||
callback.apply(null, memo[key]);
|
||||
async.nextTick(function () {
|
||||
callback.apply(null, memo[key]);
|
||||
});
|
||||
}
|
||||
else if (key in queues) {
|
||||
queues[key].push(callback);
|
||||
@ -679,6 +1021,7 @@
|
||||
}]));
|
||||
}
|
||||
};
|
||||
memoized.memo = memo;
|
||||
memoized.unmemoized = fn;
|
||||
return memoized;
|
||||
};
|
||||
@ -689,4 +1032,92 @@
|
||||
};
|
||||
};
|
||||
|
||||
async.times = function (count, iterator, callback) {
|
||||
var counter = [];
|
||||
for (var i = 0; i < count; i++) {
|
||||
counter.push(i);
|
||||
}
|
||||
return async.map(counter, iterator, callback);
|
||||
};
|
||||
|
||||
async.timesSeries = function (count, iterator, callback) {
|
||||
var counter = [];
|
||||
for (var i = 0; i < count; i++) {
|
||||
counter.push(i);
|
||||
}
|
||||
return async.mapSeries(counter, iterator, callback);
|
||||
};
|
||||
|
||||
async.seq = function (/* functions... */) {
|
||||
var fns = arguments;
|
||||
return function () {
|
||||
var that = this;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var callback = args.pop();
|
||||
async.reduce(fns, args, function (newargs, fn, cb) {
|
||||
fn.apply(that, newargs.concat([function () {
|
||||
var err = arguments[0];
|
||||
var nextargs = Array.prototype.slice.call(arguments, 1);
|
||||
cb(err, nextargs);
|
||||
}]))
|
||||
},
|
||||
function (err, results) {
|
||||
callback.apply(that, [err].concat(results));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
async.compose = function (/* functions... */) {
|
||||
return async.seq.apply(null, Array.prototype.reverse.call(arguments));
|
||||
};
|
||||
|
||||
var _applyEach = function (eachfn, fns /*args...*/) {
|
||||
var go = function () {
|
||||
var that = this;
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var callback = args.pop();
|
||||
return eachfn(fns, function (fn, cb) {
|
||||
fn.apply(that, args.concat([cb]));
|
||||
},
|
||||
callback);
|
||||
};
|
||||
if (arguments.length > 2) {
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
return go.apply(this, args);
|
||||
}
|
||||
else {
|
||||
return go;
|
||||
}
|
||||
};
|
||||
async.applyEach = doParallel(_applyEach);
|
||||
async.applyEachSeries = doSeries(_applyEach);
|
||||
|
||||
async.forever = function (fn, callback) {
|
||||
function next(err) {
|
||||
if (err) {
|
||||
if (callback) {
|
||||
return callback(err);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
fn(next);
|
||||
}
|
||||
next();
|
||||
};
|
||||
|
||||
// Node.js
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = async;
|
||||
}
|
||||
// AMD / RequireJS
|
||||
else if (typeof define !== 'undefined' && define.amd) {
|
||||
define([], function () {
|
||||
return async;
|
||||
});
|
||||
}
|
||||
// included directly via <script> tag
|
||||
else {
|
||||
root.async = async;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
32
node_modules/async/package.json
generated
vendored
32
node_modules/async/package.json
generated
vendored
File diff suppressed because one or more lines are too long
27
node_modules/catharsis/node_modules/underscore-contrib/package.json
generated
vendored
27
node_modules/catharsis/node_modules/underscore-contrib/package.json
generated
vendored
@ -30,33 +30,14 @@
|
||||
"test": "node ./node_modules/grunt-cli/bin/grunt test"
|
||||
},
|
||||
"homepage": "https://github.com/documentcloud/underscore-contrib",
|
||||
"readme": "underscore-contrib\n==================\n\nThe brass buckles on Underscore's utility belt -- a contributors' library for [Underscore](http://underscorejs.org/).\n\nLinks\n-----\n\n * [Documentation](http://documentcloud.github.io/underscore-contrib/)\n * [Source repository](https://github.com/documentcloud/underscore-contrib)\n * [Tickets and bug reports](https://github.com/documentcloud/underscore-contrib/issues?state=open)\n * [Maintainer's website](http://www.fogus.me)\n\nWhy underscore-contrib?\n-----------------------\n\nWhile Underscore provides a bevy of useful tools to support functional programming in JavaScript, it can't\n(and shouldn't) be everything to everyone. Underscore-contrib is intended as a home for functions that, for\nvarious reasons, don't belong in Underscore proper. In particular, it aims to be:\n\n * a home for functions that are limited in scope, but solve certain point problems, and\n * a proving ground for features that belong in Underscore proper, but need some advocacy and/or evolution\n(or devolution) to get them there.\n\nUse\n---\n\nFirst, you’ll need Underscore. Then you can grab the relevant underscore-contrib libraries and simply add\nsomething\nlike the following to your pages:\n\n <script type=\"text/javascript\" src=\"underscore.js\"></script>\n <script type=\"text/javascript\" src=\"underscore.object.builders.js\"></script>\n\nAt the moment there are no cross-contrib dependencies (i.e. each library can stand by itself), but that may\nchange in the future.\n\nContributing\n------------\n\nThere is still a lot of work to do around perf, documentation, examples, testing and distribution so any help\nin those areas is welcomed. Pull requests are accepted, but please search the [issues](https://github.com/documentcloud/underscore-contrib/issues)\nbefore proposing a new sub-contrib or addition. Additionally, all patches and proposals should have strong\ndocumentation, motivating cases and tests. It would be nice if we could not only provide useful tools built on\nUnderscore, but also provide an educational experience for why and how one might use them.\n\nOther (potentially) useful sub-contribs include the following:\n\n * String utilities\n * Date/time utilities\n * Validators\n * Iterators\n * Generators\n * Promises\n * Monads\n * Currying\n * Laziness\n * Multimethods\n\nWhat do these mean? Well, that’s up for discussion. :-)\n",
|
||||
"readmeFilename": "README.md",
|
||||
"description": "underscore-contrib ==================",
|
||||
"bugs": {
|
||||
"url": "https://github.com/documentcloud/underscore-contrib/issues"
|
||||
},
|
||||
"_id": "underscore-contrib@0.3.0",
|
||||
"dist": {
|
||||
"shasum": "665b66c24783f8fa2b18c9f8cbb0e2c7d48c26c7",
|
||||
"tarball": "http://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz"
|
||||
},
|
||||
"_from": "underscore-contrib@~0.3.0",
|
||||
"_npmVersion": "1.3.21",
|
||||
"_npmUser": {
|
||||
"name": "joshuacc",
|
||||
"email": "joshua.clanton@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "fogus",
|
||||
"email": "mefogus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "joshuacc",
|
||||
"email": "joshua.clanton@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "665b66c24783f8fa2b18c9f8cbb0e2c7d48c26c7",
|
||||
"_resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
"_from": "underscore-contrib@~0.3.0",
|
||||
"_resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz"
|
||||
}
|
||||
|
||||
12
node_modules/catharsis/package.json
generated
vendored
12
node_modules/catharsis/package.json
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/catharsis/res/en.json
generated
vendored
2
node_modules/catharsis/res/en.json
generated
vendored
@ -87,5 +87,5 @@
|
||||
"many": "or <%= element %>) <%= suffix %>"
|
||||
}
|
||||
},
|
||||
"unknown": "unknown type"
|
||||
"unknown": "unknown"
|
||||
}
|
||||
|
||||
2
node_modules/escape-string-regexp/package.json
generated
vendored
2
node_modules/escape-string-regexp/package.json
generated
vendored
@ -43,7 +43,7 @@
|
||||
"homepage": "https://github.com/sindresorhus/escape-string-regexp",
|
||||
"_id": "escape-string-regexp@1.0.2",
|
||||
"_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"_from": "escape-string-regexp@1.0.2",
|
||||
"_from": "escape-string-regexp@~1.0.2",
|
||||
"_npmVersion": "1.4.23",
|
||||
"_npmUser": {
|
||||
"name": "jbnicolai",
|
||||
|
||||
30
node_modules/js2xmlparser/LICENSE.md
generated
vendored
30
node_modules/js2xmlparser/LICENSE.md
generated
vendored
@ -1,16 +1,16 @@
|
||||
js2xmlparser is licensed under the MIT license:
|
||||
|
||||
> Copyright © 2012 Michael Kourlas and other 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
|
||||
js2xmlparser is licensed under the MIT license:
|
||||
|
||||
> Copyright © 2012 Michael Kourlas and other 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.
|
||||
681
node_modules/js2xmlparser/lib/js2xmlparser.js
generated
vendored
681
node_modules/js2xmlparser/lib/js2xmlparser.js
generated
vendored
@ -1,328 +1,353 @@
|
||||
/* jshint node:true */
|
||||
|
||||
/**
|
||||
* js2xmlparser
|
||||
* Copyright © 2012 Michael Kourlas and other 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
var xmlDeclaration = true;
|
||||
var xmlVersion = "1.0";
|
||||
var xmlEncoding = "UTF-8";
|
||||
var attributeString = "@";
|
||||
var valueString = "#";
|
||||
var prettyPrinting = true;
|
||||
var indentString = "\t";
|
||||
var convertMap = {};
|
||||
var useCDATA = false;
|
||||
|
||||
module.exports = function (root, data, options) {
|
||||
return toXML(init(root, data, options));
|
||||
};
|
||||
|
||||
// Initialization
|
||||
var init = function(root, data, options) {
|
||||
// Set option defaults
|
||||
setOptionDefaults();
|
||||
|
||||
// Error checking for root element
|
||||
if (typeof root !== "string") {
|
||||
throw new Error("root element must be a string");
|
||||
}
|
||||
else if (root === "") {
|
||||
throw new Error("root element cannot be empty");
|
||||
}
|
||||
|
||||
// Error checking and variable initialization for options
|
||||
if (typeof options === "object" && options !== null) {
|
||||
if ("declaration" in options) {
|
||||
if ("include" in options.declaration) {
|
||||
if (typeof options.declaration.include === "boolean") {
|
||||
xmlDeclaration = options.declaration.include;
|
||||
}
|
||||
else {
|
||||
throw new Error("declaration.include option must be a boolean");
|
||||
}
|
||||
}
|
||||
|
||||
if ("encoding" in options.declaration) {
|
||||
if (typeof options.declaration.encoding === "string" || options.declaration.encoding === null) {
|
||||
xmlEncoding = options.declaration.encoding;
|
||||
}
|
||||
else {
|
||||
throw new Error("declaration.encoding option must be a string or null");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("attributeString" in options) {
|
||||
if (typeof options.attributeString === "string") {
|
||||
attributeString = options.attributeString;
|
||||
}
|
||||
else {
|
||||
throw new Error("attributeString option must be a string");
|
||||
}
|
||||
}
|
||||
if ("valueString" in options) {
|
||||
if (typeof options.valueString === "string") {
|
||||
valueString = options.valueString;
|
||||
}
|
||||
else {
|
||||
throw new Error("valueString option must be a string");
|
||||
}
|
||||
}
|
||||
if ("prettyPrinting" in options) {
|
||||
if ("enabled" in options.prettyPrinting) {
|
||||
if (typeof options.prettyPrinting.enabled === "boolean") {
|
||||
prettyPrinting = options.prettyPrinting.enabled;
|
||||
}
|
||||
else {
|
||||
throw new Error("prettyPrinting.enabled option must be a boolean");
|
||||
}
|
||||
}
|
||||
|
||||
if ("indentString" in options.prettyPrinting) {
|
||||
if (typeof options.prettyPrinting.indentString === "string") {
|
||||
indentString = options.prettyPrinting.indentString;
|
||||
}
|
||||
else {
|
||||
throw new Error("prettyPrinting.indentString option must be a string");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("convertMap" in options) {
|
||||
if (Object.prototype.toString.call(options.convertMap) === "[object Object]") {
|
||||
convertMap = options.convertMap;
|
||||
}
|
||||
else {
|
||||
throw new Error("convertMap option must be an object");
|
||||
}
|
||||
}
|
||||
if ("useCDATA" in options) {
|
||||
if (typeof options.useCDATA === "boolean") {
|
||||
useCDATA = options.useCDATA;
|
||||
}
|
||||
else {
|
||||
throw new Error("useCDATA option must be a boolean");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Error checking and variable initialization for data
|
||||
if (typeof data !== "string" && typeof data !== "object" && typeof data !== "number" &&
|
||||
typeof data !== "boolean" && data !== null) {
|
||||
throw new Error("data must be an object (excluding arrays) or a JSON string");
|
||||
}
|
||||
|
||||
if (data === null) {
|
||||
throw new Error("data must be an object (excluding arrays) or a JSON string");
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(data) === "[object Array]") {
|
||||
throw new Error("data must be an object (excluding arrays) or a JSON string");
|
||||
}
|
||||
|
||||
if (typeof data === "string") {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
|
||||
var tempData = {};
|
||||
tempData[root] = data; // Add root element to object
|
||||
|
||||
return tempData;
|
||||
};
|
||||
|
||||
// Convert object to XML
|
||||
var toXML = function(object) {
|
||||
// Initialize arguments, if necessary
|
||||
var xml = arguments[1] || "";
|
||||
var level = arguments[2] || 0;
|
||||
|
||||
var i = null;
|
||||
var tempObject = {};
|
||||
|
||||
for (var property in object) {
|
||||
if (object.hasOwnProperty(property)) {
|
||||
// Element name cannot start with a number
|
||||
var elementName = property;
|
||||
if (/^\d/.test(property)) {
|
||||
elementName = "_" + property;
|
||||
}
|
||||
|
||||
// Arrays
|
||||
if (Object.prototype.toString.call(object[property]) === "[object Array]") {
|
||||
// Create separate XML elements for each array element
|
||||
for (i = 0; i < object[property].length; i++) {
|
||||
tempObject = {};
|
||||
tempObject[property] = object[property][i];
|
||||
|
||||
xml = toXML(tempObject, xml, level);
|
||||
}
|
||||
}
|
||||
// JSON-type objects with properties
|
||||
else if (Object.prototype.toString.call(object[property]) === "[object Object]") {
|
||||
xml += addIndent("<" + elementName, level);
|
||||
|
||||
// Add attributes
|
||||
var lengthExcludingAttributes = Object.keys(object[property]).length;
|
||||
if (Object.prototype.toString.call(object[property][attributeString]) === "[object Object]") {
|
||||
lengthExcludingAttributes -= 1;
|
||||
for (var attribute in object[property][attributeString]) {
|
||||
if (object[property][attributeString].hasOwnProperty(attribute)) {
|
||||
xml += " " + attribute + "=\"" +
|
||||
toString(object[property][attributeString][attribute], true) + "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof object[property][attributeString] !== "undefined") {
|
||||
// Fix for the case where an object contains a single property with the attribute string as its
|
||||
// name, but this property contains no attributes; in that case, lengthExcludingAttributes
|
||||
// should be set to zero to ensure that the object is considered an empty object for the
|
||||
// purposes of the following if statement.
|
||||
lengthExcludingAttributes -= 1;
|
||||
}
|
||||
|
||||
if (lengthExcludingAttributes === 0) { // Empty object
|
||||
xml += addBreak("/>");
|
||||
}
|
||||
else if (lengthExcludingAttributes === 1 && valueString in object[property]) { // Value string only
|
||||
xml += addBreak(">" + toString(object[property][valueString], false) + "</" + elementName + ">");
|
||||
}
|
||||
else { // Object with properties
|
||||
xml += addBreak(">");
|
||||
|
||||
// Create separate object for each property and pass to this function
|
||||
for (var subProperty in object[property]) {
|
||||
if (object[property].hasOwnProperty(subProperty) && subProperty !== attributeString && subProperty !== valueString) {
|
||||
tempObject = {};
|
||||
tempObject[subProperty] = object[property][subProperty];
|
||||
|
||||
xml = toXML(tempObject, xml, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
xml += addBreak(addIndent("</" + elementName + ">", level));
|
||||
}
|
||||
}
|
||||
// Everything else
|
||||
else {
|
||||
xml += addBreak(addIndent("<" + elementName + ">" + toString(object[property], false) + "</" +
|
||||
elementName + ">", level));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finalize XML at end of process
|
||||
if (level === 0) {
|
||||
// Strip trailing whitespace
|
||||
xml = xml.replace(/\s+$/g, "");
|
||||
|
||||
// Add XML declaration
|
||||
if (xmlDeclaration) {
|
||||
if (xmlEncoding === null) {
|
||||
xml = addBreak("<?xml version=\"" + xmlVersion + "\"?>") + xml;
|
||||
}
|
||||
else {
|
||||
xml = addBreak("<?xml version=\"" + xmlVersion + "\" encoding=\"" + xmlEncoding + "\"?>") + xml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xml;
|
||||
};
|
||||
|
||||
// Add indenting to data for pretty printing
|
||||
var addIndent = function(data, level) {
|
||||
if (prettyPrinting) {
|
||||
|
||||
var indent = "";
|
||||
for (var i = 0; i < level; i++) {
|
||||
indent += indentString;
|
||||
}
|
||||
data = indent + data;
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// Add line break to data for pretty printing
|
||||
var addBreak = function(data) {
|
||||
return prettyPrinting ? data + "\n" : data;
|
||||
};
|
||||
|
||||
// Convert anything into a valid XML string representation
|
||||
var toString = function(data, isAttribute) {
|
||||
// Recursive function used to handle nested functions
|
||||
var functionHelper = function(data) {
|
||||
if (Object.prototype.toString.call(data) === "[object Function]") {
|
||||
return functionHelper(data());
|
||||
}
|
||||
else {
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
// Convert map
|
||||
if (Object.prototype.toString.call(data) in convertMap) {
|
||||
data = convertMap[Object.prototype.toString.call(data)](data);
|
||||
}
|
||||
else if ("*" in convertMap) {
|
||||
data = convertMap["*"](data);
|
||||
}
|
||||
// Functions
|
||||
else if (Object.prototype.toString.call(data) === "[object Function]") {
|
||||
data = functionHelper(data());
|
||||
}
|
||||
// Empty objects
|
||||
else if (Object.prototype.toString.call(data) === "[object Object]" && Object.keys(data).length === 0) {
|
||||
data = "";
|
||||
}
|
||||
|
||||
// Cast data to string
|
||||
if (typeof data !== "string") {
|
||||
data = (data === null || typeof data === "undefined") ? "" : data.toString();
|
||||
}
|
||||
|
||||
// Output as CDATA instead of escaping if option set (and only if not an attribute value)
|
||||
if (useCDATA && !isAttribute) {
|
||||
data = "<![CDATA[" + data.replace(/]]>/gm, "]]]]><![CDATA[>") + "]]>";
|
||||
}
|
||||
else {
|
||||
// Escape illegal XML characters
|
||||
data = data.replace(/&/gm, "&")
|
||||
.replace(/</gm, "<")
|
||||
.replace(/>/gm, ">")
|
||||
.replace(/"/gm, """)
|
||||
.replace(/'/gm, "'");
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// Revert options back to their default settings
|
||||
var setOptionDefaults = function() {
|
||||
useCDATA = false;
|
||||
convertMap = {};
|
||||
xmlDeclaration = true;
|
||||
xmlVersion = "1.0";
|
||||
xmlEncoding = "UTF-8";
|
||||
attributeString = "@";
|
||||
valueString = "#";
|
||||
prettyPrinting = true;
|
||||
indentString = "\t";
|
||||
};
|
||||
})();
|
||||
/* jshint node:true */
|
||||
|
||||
/**
|
||||
* js2xmlparser
|
||||
* Copyright © 2012 Michael Kourlas and other 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.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var xmlDeclaration = true;
|
||||
var xmlVersion = "1.0";
|
||||
var xmlEncoding = "UTF-8";
|
||||
var attributeString = "@";
|
||||
var aliasString = "=";
|
||||
var valueString = "#";
|
||||
var prettyPrinting = true;
|
||||
var indentString = "\t";
|
||||
var convertMap = {};
|
||||
var useCDATA = false;
|
||||
|
||||
module.exports = function (root, data, options) {
|
||||
return toXML(init(root, data, options));
|
||||
};
|
||||
|
||||
// Initialization
|
||||
var init = function (root, data, options) {
|
||||
// Set option defaults
|
||||
setOptionDefaults();
|
||||
|
||||
// Error checking for root element
|
||||
if (typeof root !== "string") {
|
||||
throw new Error("root element must be a string");
|
||||
}
|
||||
else if (root === "") {
|
||||
throw new Error("root element cannot be empty");
|
||||
}
|
||||
|
||||
// Error checking and variable initialization for options
|
||||
if (typeof options === "object" && options !== null) {
|
||||
if ("declaration" in options) {
|
||||
if ("include" in options.declaration) {
|
||||
if (typeof options.declaration.include === "boolean") {
|
||||
xmlDeclaration = options.declaration.include;
|
||||
}
|
||||
else {
|
||||
throw new Error("declaration.include option must be a boolean");
|
||||
}
|
||||
}
|
||||
|
||||
if ("encoding" in options.declaration) {
|
||||
if (typeof options.declaration.encoding === "string" || options.declaration.encoding === null) {
|
||||
xmlEncoding = options.declaration.encoding;
|
||||
}
|
||||
else {
|
||||
throw new Error("declaration.encoding option must be a string or null");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("attributeString" in options) {
|
||||
if (typeof options.attributeString === "string") {
|
||||
attributeString = options.attributeString;
|
||||
}
|
||||
else {
|
||||
throw new Error("attributeString option must be a string");
|
||||
}
|
||||
}
|
||||
if ("valueString" in options) {
|
||||
if (typeof options.valueString === "string") {
|
||||
valueString = options.valueString;
|
||||
}
|
||||
else {
|
||||
throw new Error("valueString option must be a string");
|
||||
}
|
||||
}
|
||||
if ("aliasString" in options) {
|
||||
if (typeof options.aliasString === "string") {
|
||||
aliasString = options.aliasString;
|
||||
}
|
||||
else {
|
||||
throw new Error("aliasString option must be a string");
|
||||
}
|
||||
}
|
||||
if ("prettyPrinting" in options) {
|
||||
if ("enabled" in options.prettyPrinting) {
|
||||
if (typeof options.prettyPrinting.enabled === "boolean") {
|
||||
prettyPrinting = options.prettyPrinting.enabled;
|
||||
}
|
||||
else {
|
||||
throw new Error("prettyPrinting.enabled option must be a boolean");
|
||||
}
|
||||
}
|
||||
|
||||
if ("indentString" in options.prettyPrinting) {
|
||||
if (typeof options.prettyPrinting.indentString === "string") {
|
||||
indentString = options.prettyPrinting.indentString;
|
||||
}
|
||||
else {
|
||||
throw new Error("prettyPrinting.indentString option must be a string");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("convertMap" in options) {
|
||||
if (Object.prototype.toString.call(options.convertMap) === "[object Object]") {
|
||||
convertMap = options.convertMap;
|
||||
}
|
||||
else {
|
||||
throw new Error("convertMap option must be an object");
|
||||
}
|
||||
}
|
||||
if ("useCDATA" in options) {
|
||||
if (typeof options.useCDATA === "boolean") {
|
||||
useCDATA = options.useCDATA;
|
||||
}
|
||||
else {
|
||||
throw new Error("useCDATA option must be a boolean");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Error checking and variable initialization for data
|
||||
if (typeof data !== "string" && typeof data !== "object" && typeof data !== "number" &&
|
||||
typeof data !== "boolean" && data !== null) {
|
||||
throw new Error("data must be an object (excluding arrays) or a JSON string");
|
||||
}
|
||||
|
||||
if (data === null) {
|
||||
throw new Error("data must be an object (excluding arrays) or a JSON string");
|
||||
}
|
||||
|
||||
if (Object.prototype.toString.call(data) === "[object Array]") {
|
||||
throw new Error("data must be an object (excluding arrays) or a JSON string");
|
||||
}
|
||||
|
||||
if (typeof data === "string") {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
|
||||
var tempData = {};
|
||||
tempData[root] = data; // Add root element to object
|
||||
|
||||
return tempData;
|
||||
};
|
||||
|
||||
// Convert object to XML
|
||||
var toXML = function (object) {
|
||||
// Initialize arguments, if necessary
|
||||
var xml = arguments[1] || "";
|
||||
var level = arguments[2] || 0;
|
||||
|
||||
var i = null;
|
||||
var tempObject = {};
|
||||
|
||||
for (var property in object) {
|
||||
if (object.hasOwnProperty(property)) {
|
||||
// Element name cannot start with a number
|
||||
var elementName = property;
|
||||
if (/^\d/.test(property)) {
|
||||
elementName = "_" + property;
|
||||
}
|
||||
|
||||
// Skip alias string property
|
||||
if (elementName === aliasString) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// When alias string property is present, use as alias for element name
|
||||
if (Object.prototype.toString.call(object[property]) === "[object Object]" &&
|
||||
aliasString in object[property]) {
|
||||
elementName = object[property][aliasString];
|
||||
}
|
||||
|
||||
// Arrays
|
||||
if (Object.prototype.toString.call(object[property]) === "[object Array]") {
|
||||
// Create separate XML elements for each array element
|
||||
for (i = 0; i < object[property].length; i++) {
|
||||
tempObject = {};
|
||||
tempObject[property] = object[property][i];
|
||||
|
||||
xml = toXML(tempObject, xml, level);
|
||||
}
|
||||
}
|
||||
// JSON-type objects with properties
|
||||
else if (Object.prototype.toString.call(object[property]) === "[object Object]") {
|
||||
xml += addIndent("<" + elementName, level);
|
||||
|
||||
// Add attributes
|
||||
var lengthExcludingAttributes = Object.keys(object[property]).length;
|
||||
if (Object.prototype.toString.call(object[property][attributeString]) === "[object Object]") {
|
||||
lengthExcludingAttributes -= 1;
|
||||
for (var attribute in object[property][attributeString]) {
|
||||
if (object[property][attributeString].hasOwnProperty(attribute)) {
|
||||
xml += " " + attribute + "=\"" +
|
||||
toString(object[property][attributeString][attribute], true) + "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof object[property][attributeString] !== "undefined") {
|
||||
// Fix for the case where an object contains a single property with the attribute string as its
|
||||
// name, but this property contains no attributes; in that case, lengthExcludingAttributes
|
||||
// should be set to zero to ensure that the object is considered an empty object for the
|
||||
// purposes of the following if statement.
|
||||
lengthExcludingAttributes -= 1;
|
||||
}
|
||||
|
||||
if (lengthExcludingAttributes === 0) { // Empty object
|
||||
xml += addBreak("/>");
|
||||
}
|
||||
else if ((lengthExcludingAttributes === 1 ||
|
||||
(lengthExcludingAttributes === 2 && aliasString in object[property])) &&
|
||||
valueString in object[property]) { // Value string only
|
||||
xml += addBreak(">" + toString(object[property][valueString], false) + "</" + elementName +
|
||||
">");
|
||||
}
|
||||
else { // Object with properties
|
||||
xml += addBreak(">");
|
||||
|
||||
// Create separate object for each property and pass to this function
|
||||
for (var subProperty in object[property]) {
|
||||
if (object[property].hasOwnProperty(subProperty) && subProperty !== attributeString &&
|
||||
subProperty !== valueString) {
|
||||
tempObject = {};
|
||||
tempObject[subProperty] = object[property][subProperty];
|
||||
|
||||
xml = toXML(tempObject, xml, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
xml += addBreak(addIndent("</" + elementName + ">", level));
|
||||
}
|
||||
}
|
||||
// Everything else
|
||||
else {
|
||||
xml += addBreak(addIndent("<" + elementName + ">" + toString(object[property], false) + "</" +
|
||||
elementName + ">", level));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finalize XML at end of process
|
||||
if (level === 0) {
|
||||
// Strip trailing whitespace
|
||||
xml = xml.replace(/\s+$/g, "");
|
||||
|
||||
// Add XML declaration
|
||||
if (xmlDeclaration) {
|
||||
if (xmlEncoding === null) {
|
||||
xml = addBreak("<?xml version=\"" + xmlVersion + "\"?>") + xml;
|
||||
}
|
||||
else {
|
||||
xml = addBreak("<?xml version=\"" + xmlVersion + "\" encoding=\"" + xmlEncoding + "\"?>") + xml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xml;
|
||||
};
|
||||
|
||||
// Add indenting to data for pretty printing
|
||||
var addIndent = function (data, level) {
|
||||
if (prettyPrinting) {
|
||||
|
||||
var indent = "";
|
||||
for (var i = 0; i < level; i++) {
|
||||
indent += indentString;
|
||||
}
|
||||
data = indent + data;
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// Add line break to data for pretty printing
|
||||
var addBreak = function (data) {
|
||||
return prettyPrinting ? data + "\n" : data;
|
||||
};
|
||||
|
||||
// Convert anything into a valid XML string representation
|
||||
var toString = function (data, isAttribute) {
|
||||
// Recursive function used to handle nested functions
|
||||
var functionHelper = function (data) {
|
||||
if (Object.prototype.toString.call(data) === "[object Function]") {
|
||||
return functionHelper(data());
|
||||
}
|
||||
else {
|
||||
return data;
|
||||
}
|
||||
};
|
||||
|
||||
// Convert map
|
||||
if (Object.prototype.toString.call(data) in convertMap) {
|
||||
data = convertMap[Object.prototype.toString.call(data)](data);
|
||||
}
|
||||
else if ("*" in convertMap) {
|
||||
data = convertMap["*"](data);
|
||||
}
|
||||
// Functions
|
||||
else if (Object.prototype.toString.call(data) === "[object Function]") {
|
||||
data = functionHelper(data());
|
||||
}
|
||||
// Empty objects
|
||||
else if (Object.prototype.toString.call(data) === "[object Object]" && Object.keys(data).length === 0) {
|
||||
data = "";
|
||||
}
|
||||
|
||||
// Cast data to string
|
||||
if (typeof data !== "string") {
|
||||
data = (data === null || typeof data === "undefined") ? "" : data.toString();
|
||||
}
|
||||
|
||||
// Output as CDATA instead of escaping if option set (and only if not an attribute value)
|
||||
if (useCDATA && !isAttribute) {
|
||||
data = "<![CDATA[" + data.replace(/]]>/gm, "]]]]><![CDATA[>") + "]]>";
|
||||
}
|
||||
else {
|
||||
// Escape illegal XML characters
|
||||
data = data.replace(/&/gm, "&")
|
||||
.replace(/</gm, "<")
|
||||
.replace(/>/gm, ">")
|
||||
.replace(/"/gm, """)
|
||||
.replace(/'/gm, "'");
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// Revert options back to their default settings
|
||||
var setOptionDefaults = function () {
|
||||
useCDATA = false;
|
||||
convertMap = {};
|
||||
xmlDeclaration = true;
|
||||
xmlVersion = "1.0";
|
||||
xmlEncoding = "UTF-8";
|
||||
attributeString = "@";
|
||||
aliasString = "=";
|
||||
valueString = "#";
|
||||
prettyPrinting = true;
|
||||
indentString = "\t";
|
||||
};
|
||||
})();
|
||||
|
||||
28
node_modules/js2xmlparser/package.json
generated
vendored
28
node_modules/js2xmlparser/package.json
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/marked/package.json
generated
vendored
2
node_modules/marked/package.json
generated
vendored
@ -45,6 +45,6 @@
|
||||
"readmeFilename": "README.md",
|
||||
"_id": "marked@0.3.2",
|
||||
"_shasum": "015db158864438f24a64bdd61a0428b418706d09",
|
||||
"_from": "marked@0.3.2",
|
||||
"_from": "marked@~0.3.2",
|
||||
"_resolved": "https://registry.npmjs.org/marked/-/marked-0.3.2.tgz"
|
||||
}
|
||||
|
||||
33
node_modules/strip-json-comments/package.json
generated
vendored
33
node_modules/strip-json-comments/package.json
generated
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strip-json-comments",
|
||||
"version": "0.1.3",
|
||||
"version": "1.0.2",
|
||||
"description": "Strip comments from JSON. Lets you use comments in your JSON files!",
|
||||
"keywords": [
|
||||
"json",
|
||||
@ -37,7 +37,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/strip-json-comments"
|
||||
"url": "https://github.com/sindresorhus/strip-json-comments"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
@ -48,14 +48,31 @@
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"readme": "# strip-json-comments [](https://travis-ci.org/sindresorhus/strip-json-comments)\n\n> Strip comments from JSON. Lets you use comments in your JSON files!\n\nThis is now possible:\n\n```js\n{\n\t// rainbows\n\t\"unicorn\": /* ❤ */ \"cake\"\n}\n```\n\nIt will remove single-line comments `//` and mult-line comments `/**/`.\n\nAlso available as a [gulp](https://github.com/sindresorhus/gulp-strip-json-comments)/[grunt](https://github.com/sindresorhus/grunt-strip-json-comments)/[broccoli](https://github.com/sindresorhus/broccoli-strip-json-comments) plugin and a [require hook](https://github.com/uTest/autostrip-json-comments).\n\n\n*There's already [json-comments](https://npmjs.org/package/json-comments), but it's only for Node.js and uses a naive regex to strip comments which fails on simple cases like `{\"a\":\"//\"}`. This module however parses out the comments.*\n\n\n## Install\n\n```sh\n$ npm install --save strip-json-comments\n```\n\n```sh\n$ bower install --save strip-json-comments\n```\n\n```sh\n$ component install sindresorhus/strip-json-comments\n```\n\n\n## Usage\n\n```js\nvar json = '{/*rainbows*/\"unicorn\":\"cake\"}';\nJSON.parse(stripJsonComments(json));\n//=> {unicorn: 'cake'}\n```\n\n\n## API\n\n### stripJsonComments(input)\n\n#### input\n\nType: `string`\n\nAccepts a string with JSON and returns a string without comments.\n\n\n## CLI\n\n```sh\n$ npm install --global strip-json-comments\n```\n\n```sh\n$ strip-json-comments --help\n\nstrip-json-comments <input-file> > <output-file>\n# or\ncat <input-file> | strip-json-comments > <output-file>\n```\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
|
||||
"readmeFilename": "readme.md",
|
||||
"gitHead": "142dd671c71f90fb7fdba440184b1bb64543acb3",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/strip-json-comments/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/strip-json-comments",
|
||||
"_id": "strip-json-comments@0.1.3",
|
||||
"_shasum": "164c64e370a8a3cc00c9e01b539e569823f0ee54",
|
||||
"_from": "strip-json-comments@0.1.3",
|
||||
"_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.3.tgz"
|
||||
"_id": "strip-json-comments@1.0.2",
|
||||
"_shasum": "5a48ab96023dbac1b7b8d0ffabf6f63f1677be9f",
|
||||
"_from": "strip-json-comments@~1.0.2",
|
||||
"_npmVersion": "2.1.2",
|
||||
"_nodeVersion": "0.10.32",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "5a48ab96023dbac1b7b8d0ffabf6f63f1677be9f",
|
||||
"tarball": "http://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
|
||||
3
node_modules/strip-json-comments/strip-json-comments.js
generated
vendored
3
node_modules/strip-json-comments/strip-json-comments.js
generated
vendored
@ -34,6 +34,9 @@
|
||||
} else if (insideComment === 'single' && currentChar + nextChar === '\r\n') {
|
||||
insideComment = false;
|
||||
i++;
|
||||
ret += currentChar;
|
||||
ret += nextChar;
|
||||
continue;
|
||||
} else if (insideComment === 'single' && currentChar === '\n') {
|
||||
insideComment = false;
|
||||
} else if (!insideComment && currentChar + nextChar === '/*') {
|
||||
|
||||
4
node_modules/taffydb/package.json
generated
vendored
4
node_modules/taffydb/package.json
generated
vendored
@ -16,6 +16,6 @@
|
||||
"homepage": "https://github.com/hegemonic/taffydb",
|
||||
"_id": "taffydb@2.6.2",
|
||||
"_shasum": "3c549d2f5712d7d1d109ad6bb1a4084f1b7add4e",
|
||||
"_from": "https://github.com/hegemonic/taffydb/tarball/master",
|
||||
"_resolved": "https://github.com/hegemonic/taffydb/tarball/master"
|
||||
"_from": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e",
|
||||
"_resolved": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e"
|
||||
}
|
||||
|
||||
37
node_modules/underscore/package.json
generated
vendored
37
node_modules/underscore/package.json
generated
vendored
@ -18,14 +18,15 @@
|
||||
"url": "git://github.com/jashkenas/underscore.git"
|
||||
},
|
||||
"main": "underscore.js",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"devDependencies": {
|
||||
"docco": "0.6.x",
|
||||
"phantomjs": "1.9.0-1",
|
||||
"uglify-js": "2.4.x"
|
||||
"phantomjs": "1.9.7-1",
|
||||
"uglify-js": "2.4.x",
|
||||
"eslint": "0.6.x"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true",
|
||||
"test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true && eslint underscore.js test/*.js test/vendor/runner.js",
|
||||
"build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js",
|
||||
"doc": "docco underscore.js"
|
||||
},
|
||||
@ -40,13 +41,29 @@
|
||||
"underscore-min.js",
|
||||
"LICENSE"
|
||||
],
|
||||
"readme": " __\n /\\ \\ __\n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____\n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\\n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/\n \\ \\____/\n \\/___/\n\nUnderscore.js is a utility-belt library for JavaScript that provides\nsupport for the usual functional suspects (each, map, reduce, filter...)\nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://underscorejs.org\n\nUnderscore is an open-sourced component of DocumentCloud:\nhttps://github.com/documentcloud\n\nMany thanks to our contributors:\nhttps://github.com/jashkenas/underscore/contributors\n",
|
||||
"readmeFilename": "README.md",
|
||||
"gitHead": "da996e665deb0b69b257e80e3e257c04fde4191c",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jashkenas/underscore/issues"
|
||||
},
|
||||
"_id": "underscore@1.6.0",
|
||||
"_shasum": "8b38b10cacdef63337b8b24e4ff86d45aea529a8",
|
||||
"_from": "underscore@1.6.0",
|
||||
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
|
||||
"_id": "underscore@1.7.0",
|
||||
"_shasum": "6bbaf0877500d36be34ecaa584e0db9fef035209",
|
||||
"_from": "underscore@~1.7.0",
|
||||
"_npmVersion": "1.4.24",
|
||||
"_npmUser": {
|
||||
"name": "jashkenas",
|
||||
"email": "jashkenas@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jashkenas",
|
||||
"email": "jashkenas@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "6bbaf0877500d36be34ecaa584e0db9fef035209",
|
||||
"tarball": "http://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
|
||||
920
node_modules/underscore/underscore.js
generated
vendored
920
node_modules/underscore/underscore.js
generated
vendored
File diff suppressed because it is too large
Load Diff
242
node_modules/wrench/lib/wrench.js
generated
vendored
242
node_modules/wrench/lib/wrench.js
generated
vendored
@ -12,8 +12,8 @@
|
||||
*/
|
||||
|
||||
var fs = require("fs"),
|
||||
_path = require("path");
|
||||
|
||||
_path = require("path"),
|
||||
isWindows = !!process.platform.match(/^win/);
|
||||
|
||||
/* wrench.readdirSyncRecursive("directory_path");
|
||||
*
|
||||
@ -28,7 +28,7 @@ exports.readdirSyncRecursive = function(baseDir) {
|
||||
curFiles,
|
||||
nextDirs,
|
||||
isDir = function(fname){
|
||||
return fs.statSync( _path.join(baseDir, fname) ).isDirectory();
|
||||
return fs.existsSync(_path.join(baseDir, fname)) ? fs.statSync( _path.join(baseDir, fname) ).isDirectory() : false;
|
||||
},
|
||||
prependBaseDir = function(fname){
|
||||
return _path.join(baseDir, fname);
|
||||
@ -71,15 +71,16 @@ exports.readdirRecursive = function(baseDir, fn) {
|
||||
var waitCount = 0;
|
||||
|
||||
function readdirRecursive(curDir) {
|
||||
var files = [],
|
||||
curFiles,
|
||||
nextDirs,
|
||||
prependcurDir = function(fname){
|
||||
return _path.join(curDir, fname);
|
||||
};
|
||||
var prependcurDir = function(fname){
|
||||
return _path.join(curDir, fname);
|
||||
};
|
||||
|
||||
waitCount++;
|
||||
fs.readdir(curDir, function(e, curFiles) {
|
||||
if (e) {
|
||||
fn(e);
|
||||
return;
|
||||
}
|
||||
waitCount--;
|
||||
|
||||
curFiles = curFiles.map(prependcurDir);
|
||||
@ -120,7 +121,9 @@ exports.readdirRecursive = function(baseDir, fn) {
|
||||
|
||||
|
||||
|
||||
/* wrench.rmdirSyncRecursive("directory_path", forceDelete, failSilent);
|
||||
|
||||
|
||||
/* wrench.rmdirSyncRecursive("directory_path", failSilent);
|
||||
*
|
||||
* Recursively dives through directories and obliterates everything about it. This is a
|
||||
* Sync-function, which blocks things until it's done. No idea why anybody would want an
|
||||
@ -132,44 +135,110 @@ exports.rmdirSyncRecursive = function(path, failSilent) {
|
||||
try {
|
||||
files = fs.readdirSync(path);
|
||||
} catch (err) {
|
||||
|
||||
if(failSilent) return;
|
||||
throw new Error(err.message);
|
||||
}
|
||||
|
||||
/* Loop through and delete everything in the sub-tree after checking it */
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
var currFile = fs.lstatSync(path + "/" + files[i]);
|
||||
var file = _path.join(path, files[i]);
|
||||
var currFile = fs.lstatSync(file);
|
||||
|
||||
if(currFile.isDirectory()) // Recursive function back to the beginning
|
||||
exports.rmdirSyncRecursive(path + "/" + files[i]);
|
||||
if(currFile.isDirectory()) {
|
||||
// Recursive function back to the beginning
|
||||
exports.rmdirSyncRecursive(file);
|
||||
} else if(currFile.isSymbolicLink()) {
|
||||
// Unlink symlinks
|
||||
if (isWindows) {
|
||||
fs.chmodSync(file, 666) // Windows needs this unless joyent/node#3006 is resolved..
|
||||
}
|
||||
|
||||
else if(currFile.isSymbolicLink()) // Unlink symlinks
|
||||
fs.unlinkSync(path + "/" + files[i]);
|
||||
fs.unlinkSync(file);
|
||||
} else {
|
||||
// Assume it's a file - perhaps a try/catch belongs here?
|
||||
if (isWindows) {
|
||||
fs.chmodSync(file, 666) // Windows needs this unless joyent/node#3006 is resolved..
|
||||
}
|
||||
|
||||
else // Assume it's a file - perhaps a try/catch belongs here?
|
||||
fs.unlinkSync(path + "/" + files[i]);
|
||||
fs.unlinkSync(file);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now that we know everything in the sub-tree has been deleted, we can delete the main
|
||||
directory. Huzzah for the shopkeep. */
|
||||
directory. Huzzah for the shopkeep. */
|
||||
return fs.rmdirSync(path);
|
||||
};
|
||||
|
||||
|
||||
|
||||
function isFileIncluded(opts, dir, filename) {
|
||||
|
||||
function isMatch(filter) {
|
||||
if (typeof filter === 'function') {
|
||||
return filter(filename, dir) === true;
|
||||
}
|
||||
else {
|
||||
// Maintain backwards compatibility and use just the filename
|
||||
return filename.match(filter);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.include || opts.exclude) {
|
||||
if (opts.exclude) {
|
||||
if (isMatch(opts.exclude)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.include) {
|
||||
if (isMatch(opts.include)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (opts.filter) {
|
||||
var filter = opts.filter;
|
||||
|
||||
if (!opts.whitelist) {
|
||||
// if !opts.whitelist is false every file or directory
|
||||
// which does match opts.filter will be ignored
|
||||
return isMatch(filter) ? false : true;
|
||||
} else {
|
||||
// if opts.whitelist is true every file or directory
|
||||
// which doesn't match opts.filter will be ignored
|
||||
return !isMatch(filter) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* wrench.copyDirSyncRecursive("directory_to_copy", "new_directory_location", opts);
|
||||
*
|
||||
* Recursively dives through a directory and moves all its files to a new location. This is a
|
||||
* Synchronous function, which blocks things until it's done. If you need/want to do this in
|
||||
* an Asynchronous manner, look at wrench.copyDirRecursively() below.
|
||||
* an Asynchronous manner, look at wrench.copyDirRecursively() below. Specify forceDelete to force directory overwrite.
|
||||
*
|
||||
* Note: Directories should be passed to this function without a trailing slash.
|
||||
*/
|
||||
exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
if (!opts || !opts.preserve) {
|
||||
try {
|
||||
if(fs.statSync(newDirLocation).isDirectory()) exports.rmdirSyncRecursive(newDirLocation);
|
||||
} catch(e) { }
|
||||
}
|
||||
try {
|
||||
if(fs.statSync(newDirLocation).isDirectory()) {
|
||||
if(opts.forceDelete) {
|
||||
exports.rmdirSyncRecursive(newDirLocation);
|
||||
} else {
|
||||
return new Error('You are trying to delete a directory that already exists. Specify forceDelete in the opts argument to override this. Bailing~');
|
||||
}
|
||||
}
|
||||
} catch(e) { }
|
||||
|
||||
/* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
|
||||
var checkDir = fs.statSync(sourceDir);
|
||||
@ -181,20 +250,58 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
|
||||
}
|
||||
|
||||
var files = fs.readdirSync(sourceDir);
|
||||
var hasFilter = opts.filter || opts.include || opts.exclude;
|
||||
var preserveFiles = opts.preserveFiles === true;
|
||||
var preserveTimestamps = opts.preserveTimestamps === true;
|
||||
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
|
||||
// ignores all files or directories which match the RegExp in opts.filter
|
||||
if(typeof opts !== 'undefined') {
|
||||
if (hasFilter) {
|
||||
if (!isFileIncluded(opts, sourceDir, files[i])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.excludeHiddenUnix && /^\./.test(files[i])) continue;
|
||||
}
|
||||
|
||||
var currFile = fs.lstatSync(_path.join(sourceDir, files[i]));
|
||||
|
||||
var fCopyFile = function(srcFile, destFile) {
|
||||
if(typeof opts !== 'undefined' && opts.preserveFiles && fs.existsSync(destFile)) return;
|
||||
|
||||
var contents = fs.readFileSync(srcFile);
|
||||
fs.writeFileSync(destFile, contents);
|
||||
var stat = fs.lstatSync(srcFile);
|
||||
fs.chmodSync(destFile, stat.mode);
|
||||
if (preserveTimestamps) {
|
||||
fs.utimesSync(destFile, stat.atime, stat.mtime)
|
||||
}
|
||||
};
|
||||
|
||||
if(currFile.isDirectory()) {
|
||||
/* recursion this thing right on back. */
|
||||
exports.copyDirSyncRecursive(sourceDir + "/" + files[i], newDirLocation + "/" + files[i], opts);
|
||||
exports.copyDirSyncRecursive(_path.join(sourceDir, files[i]), _path.join(newDirLocation, files[i]), opts);
|
||||
} else if(currFile.isSymbolicLink()) {
|
||||
var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]);
|
||||
fs.symlinkSync(symlinkFull, newDirLocation + "/" + files[i]);
|
||||
var symlinkFull = fs.readlinkSync(_path.join(sourceDir, files[i]));
|
||||
symlinkFull = _path.resolve(fs.realpathSync(sourceDir), symlinkFull);
|
||||
|
||||
if (typeof opts !== 'undefined' && !opts.inflateSymlinks) {
|
||||
fs.symlinkSync(symlinkFull, _path.join(newDirLocation, files[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
var tmpCurrFile = fs.lstatSync(symlinkFull);
|
||||
if (tmpCurrFile.isDirectory()) {
|
||||
exports.copyDirSyncRecursive(symlinkFull, _path.join(newDirLocation, files[i]), opts);
|
||||
} else {
|
||||
/* At this point, we've hit a file actually worth copying... so copy it on over. */
|
||||
fCopyFile(symlinkFull, _path.join(newDirLocation, files[i]));
|
||||
}
|
||||
} else {
|
||||
/* At this point, we've hit a file actually worth copying... so copy it on over. */
|
||||
var contents = fs.readFileSync(sourceDir + "/" + files[i]);
|
||||
fs.writeFileSync(newDirLocation + "/" + files[i], contents);
|
||||
fCopyFile(_path.join(sourceDir, files[i]), _path.join(newDirLocation, files[i]));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -210,14 +317,14 @@ exports.chmodSyncRecursive = function(sourceDir, filemode) {
|
||||
var files = fs.readdirSync(sourceDir);
|
||||
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
|
||||
var currFile = fs.lstatSync(_path.join(sourceDir, files[i]));
|
||||
|
||||
if(currFile.isDirectory()) {
|
||||
/* ...and recursion this thing right on back. */
|
||||
exports.chmodSyncRecursive(sourceDir + "/" + files[i], filemode);
|
||||
exports.chmodSyncRecursive(_path.join(sourceDir, files[i]), filemode);
|
||||
} else {
|
||||
/* At this point, we've hit a file actually worth copying... so copy it on over. */
|
||||
fs.chmod(sourceDir + "/" + files[i], filemode);
|
||||
fs.chmod(_path.join(sourceDir, files[i]), filemode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,14 +344,14 @@ exports.chownSyncRecursive = function(sourceDir, uid, gid) {
|
||||
var files = fs.readdirSync(sourceDir);
|
||||
|
||||
for(var i = 0; i < files.length; i++) {
|
||||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
|
||||
var currFile = fs.lstatSync(_path.join(sourceDir, files[i]));
|
||||
|
||||
if(currFile.isDirectory()) {
|
||||
/* ...and recursion this thing right on back. */
|
||||
exports.chownSyncRecursive(sourceDir + "/" + files[i], uid, gid);
|
||||
exports.chownSyncRecursive(_path.join(sourceDir, files[i]), uid, gid);
|
||||
} else {
|
||||
/* At this point, we've hit a file actually worth chowning... so own it. */
|
||||
fs.chownSync(sourceDir + "/" + files[i], uid, gid);
|
||||
fs.chownSync(_path.join(sourceDir, files[i]), uid, gid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,9 +365,17 @@ exports.chownSyncRecursive = function(sourceDir, uid, gid) {
|
||||
*
|
||||
* Recursively dives through directories and obliterates everything about it.
|
||||
*/
|
||||
exports.rmdirRecursive = function rmdirRecursive(dir, clbk){
|
||||
fs.readdir(dir, function(err, files){
|
||||
if (err) return clbk(err);
|
||||
exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
|
||||
if(clbk === null || typeof clbk == 'undefined')
|
||||
clbk = function(err) {};
|
||||
|
||||
fs.readdir(dir, function(err, files) {
|
||||
if(err && typeof failSilent === 'boolean' && !failSilent)
|
||||
return clbk(err);
|
||||
|
||||
if(typeof failSilent === 'function')
|
||||
clbk = failSilent;
|
||||
|
||||
(function rmFile(err){
|
||||
if (err) return clbk(err);
|
||||
|
||||
@ -269,7 +384,7 @@ exports.rmdirRecursive = function rmdirRecursive(dir, clbk){
|
||||
return fs.rmdir(dir, clbk);
|
||||
|
||||
var file = dir+'/'+filename;
|
||||
fs.stat(file, function(err, stat){
|
||||
fs.lstat(file, function(err, stat){
|
||||
if (err) return clbk(err);
|
||||
if (stat.isDirectory())
|
||||
rmdirRecursive(file, rmFile);
|
||||
@ -280,18 +395,30 @@ exports.rmdirRecursive = function rmdirRecursive(dir, clbk){
|
||||
});
|
||||
};
|
||||
|
||||
/* wrench.copyDirRecursive("directory_to_copy", "new_location", callback);
|
||||
/* wrench.copyDirRecursive("directory_to_copy", "new_location", {forceDelete: bool}, callback);
|
||||
*
|
||||
* Recursively dives through a directory and moves all its files to a new
|
||||
* location.
|
||||
* location. Specify forceDelete to force directory overwrite.
|
||||
*
|
||||
* Note: Directories should be passed to this function without a trailing slash.
|
||||
*/
|
||||
exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, clbk) {
|
||||
fs.stat(newDir, function(err, newDirStat){
|
||||
if (!err) return exports.rmdirRecursive(newDir, function(err){
|
||||
copyDirRecursive(srcDir, newDir, clbk);
|
||||
});
|
||||
exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk) {
|
||||
var originalArguments = Array.prototype.slice.apply(arguments);
|
||||
srcDir = _path.normalize(srcDir);
|
||||
newDir = _path.normalize(newDir);
|
||||
|
||||
fs.stat(newDir, function(err, newDirStat) {
|
||||
if(!err) {
|
||||
if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete)
|
||||
return exports.rmdirRecursive(newDir, function(err) {
|
||||
copyDirRecursive.apply(this, originalArguments);
|
||||
});
|
||||
else
|
||||
return clbk(new Error('You are trying to delete a directory that already exists. Specify forceDelete in an options object to override this.'));
|
||||
}
|
||||
|
||||
if(typeof opts === 'function')
|
||||
clbk = opts;
|
||||
|
||||
fs.stat(srcDir, function(err, srcDirStat){
|
||||
if (err) return clbk(err);
|
||||
@ -304,20 +431,23 @@ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, clbk) {
|
||||
|
||||
var filename = files.shift();
|
||||
if (filename === null || typeof filename == 'undefined')
|
||||
return clbk();
|
||||
return clbk(null);
|
||||
|
||||
var file = srcDir+'/'+filename,
|
||||
newFile = newDir+'/'+filename;
|
||||
|
||||
fs.stat(file, function(err, fileStat){
|
||||
if (err) return clbk(err);
|
||||
if (fileStat.isDirectory())
|
||||
copyDirRecursive(file, newFile, copyFiles);
|
||||
copyDirRecursive(file, newFile, copyFiles, clbk);
|
||||
else if (fileStat.isSymbolicLink())
|
||||
fs.readlink(file, function(err, link){
|
||||
if (err) return clbk(err);
|
||||
fs.symlink(link, newFile, copyFiles);
|
||||
});
|
||||
else
|
||||
fs.readFile(file, function(err, data){
|
||||
if (err) return clbk(err);
|
||||
fs.writeFile(newFile, data, copyFiles);
|
||||
});
|
||||
});
|
||||
@ -330,15 +460,13 @@ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, clbk) {
|
||||
|
||||
var mkdirSyncRecursive = function(path, mode) {
|
||||
var self = this;
|
||||
path = _path.normalize(path)
|
||||
|
||||
try {
|
||||
fs.mkdirSync(path, mode);
|
||||
} catch(err) {
|
||||
if(err.code == "ENOENT") {
|
||||
var slashIdx = path.lastIndexOf("/");
|
||||
if(slashIdx < 0) {
|
||||
slashIdx = path.lastIndexOf("\\");
|
||||
}
|
||||
var slashIdx = path.lastIndexOf(_path.sep);
|
||||
|
||||
if(slashIdx > 0) {
|
||||
var parentPath = path.substring(0, slashIdx);
|
||||
@ -364,6 +492,10 @@ exports.LineReader = function(filename, bufferSize) {
|
||||
};
|
||||
|
||||
exports.LineReader.prototype = {
|
||||
close: function() {
|
||||
return fs.closeSync(this.fd);
|
||||
},
|
||||
|
||||
getBufferAndSetCurrentPosition: function(position) {
|
||||
var res = fs.readSync(this.fd, this.bufferSize, position, "ascii");
|
||||
|
||||
@ -383,13 +515,13 @@ exports.LineReader.prototype = {
|
||||
if(this.currentPosition === -1) return false;
|
||||
}
|
||||
|
||||
if(this.buffer.indexOf("\n") > -1) return true;
|
||||
if(this.buffer.indexOf("\n") > -1 || this.buffer.length !== 0) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
getNextLine: function() {
|
||||
var lineEnd = this.buffer.indexOf("\n"),
|
||||
result = this.buffer.substring(0, lineEnd);
|
||||
result = this.buffer.substring(0, lineEnd != -1 ? lineEnd : this.buffer.length);
|
||||
|
||||
this.buffer = this.buffer.substring(result.length + 1, this.buffer.length);
|
||||
return result;
|
||||
|
||||
12
node_modules/wrench/package.json
generated
vendored
12
node_modules/wrench/package.json
generated
vendored
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wrench",
|
||||
"description": "Recursive filesystem (and other) operations that Node *should* have.",
|
||||
"version": "1.3.9",
|
||||
"version": "1.5.8",
|
||||
"author": {
|
||||
"name": "Ryan McGrath",
|
||||
"email": "ryan@venodesigns.net"
|
||||
@ -33,11 +33,11 @@
|
||||
"url": "http://github.com/ryanmcgrath/wrench-js/raw/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"readme": "wrench.js - Recursive file operations in Node.js\n----------------------------------------------------------------------------\nWhile I love Node.js, I've found myself missing some functions. Things like\nrecursively deleting/chmodding a directory (or even deep copying a directory),\nor even a basic line reader, shouldn't need to be re-invented time and time again.\n\nThat said, here's my attempt at a re-usable solution, at least until something\nmore formalized gets integrated into Node.js (*hint hint*). wrench.js is fairly simple\nto use - check out the documentation/examples below:\n\nInstallation\n-----------------------------------------------------------------------------\n\n npm install wrench\n\nUsage\n-----------------------------------------------------------------------------\n``` javascript\nvar wrench = require('wrench'),\n\tutil = require('util');\n```\n\n### Synchronous operations\n``` javascript\n// Recursively create directories, sub-trees and all.\nwrench.mkdirSyncRecursive(dir, 0777);\n\n// Recursively delete the entire sub-tree of a directory, then kill the directory\nwrench.rmdirSyncRecursive('my_directory_name', failSilently);\n\n// Recursively read directories contents.\nwrench.readdirSyncRecursive('my_directory_name');\n\n// Recursively chmod the entire sub-tree of a directory\nwrench.chmodSyncRecursive('my_directory_name', 0755);\n\n// Recursively chown the entire sub-tree of a directory\nwrench.chownSyncRecursive(\"directory\", uid, gid);\n\n// Deep-copy an existing directory\nwrench.copyDirSyncRecursive('directory_to_copy', 'location_where_copy_should_end_up');\n\n// Read lines in from a file until you hit the end\nvar f = new wrench.LineReader('x.txt');\nwhile(f.hasNextLine()) {\n\tutil.puts(x.getNextLine());\n}\n```\n\n### Asynchronous operations\n``` javascript\n// Recursively read directories contents\nvar files = [];\nwrench.readdirRecursive('my_directory_name', function(error, curFiles) {\n // curFiles is what you want\n});\n\n```\n\nQuestions, comments? Hit me up. (ryan [at] venodesigns.net | http://twitter.com/ryanmcgrath)\n",
|
||||
"readme": "wrench.js - Recursive file operations in Node.js\n----------------------------------------------------------------------------\nWhile I love Node.js, I've found myself missing some functions. Things like\nrecursively deleting/chmodding a directory (or even deep copying a directory),\nor even a basic line reader, shouldn't need to be re-invented time and time again.\n\nThat said, here's my attempt at a re-usable solution, at least until something\nmore formalized gets integrated into Node.js (*hint hint*). wrench.js is fairly simple\nto use - check out the documentation/examples below:\n\nPossibly Breaking Change in v1.5.0\n-----------------------------------------------------------------------------\nIn previous versions of Wrench, we went against the OS-default behavior of not\ndeleting a directory unless the operation is forced. In 1.5.0, this has been\nchanged to be the behavior people expect there to be - if you try to copy over\na directory that already exists, you'll get an Error returned or thrown stating\nthat you need to force it.\n\nSomething like this will do the trick:\n\n``` javascript\nwrench.copyDirSyncRecursive('directory_to_copy', 'location_where_copy_should_end_up', {\n forceDelete: true\n});\n```\n\nIf you desire the older behavior of Wrench... hit up your package.json. If you\nhappen to find bugs in the 1.5.0 release please feel free to file them on the \nGitHub issues tracker for this project, or send me a pull request and I'll get to\nit as fast as I can. Thanks!\n\n**If this breaks enough projects I will consider rolling it back. Please hit me up if this seems to be the case.**\n\nInstallation\n-----------------------------------------------------------------------------\n\n npm install wrench\n\nUsage\n-----------------------------------------------------------------------------\n``` javascript\nvar wrench = require('wrench'),\n\tutil = require('util');\n```\n\n### Synchronous operations\n``` javascript\n// Recursively create directories, sub-trees and all.\nwrench.mkdirSyncRecursive(dir, 0777);\n\n// Recursively delete the entire sub-tree of a directory, then kill the directory\nwrench.rmdirSyncRecursive('my_directory_name', failSilently);\n\n// Recursively read directories contents.\nwrench.readdirSyncRecursive('my_directory_name');\n\n// Recursively chmod the entire sub-tree of a directory\nwrench.chmodSyncRecursive('my_directory_name', 0755);\n\n// Recursively chown the entire sub-tree of a directory\nwrench.chownSyncRecursive(\"directory\", uid, gid);\n\n// Deep-copy an existing directory\nwrench.copyDirSyncRecursive('directory_to_copy', 'location_where_copy_should_end_up', {\n forceDelete: bool, // Whether to overwrite existing directory or not\n excludeHiddenUnix: bool, // Whether to copy hidden Unix files or not (preceding .)\n preserveFiles: bool, // If we're overwriting something and the file already exists, keep the existing\n preserveTimestamps: bool, // Preserve the mtime and atime when copying files\n inflateSymlinks: bool, // Whether to follow symlinks or not when copying files\n filter: regexpOrFunction, // A filter to match files against; if matches, do nothing (exclude).\n whitelist: bool, // if true every file or directory which doesn't match filter will be ignored\n include: regexpOrFunction, // An include filter (either a regexp or a function)\n exclude: regexpOrFunction // An exclude filter (either a regexp or a function)\n});\n\n// Note: If a RegExp is provided then then it will be matched against the filename. If a function is\n// provided then the signature should be the following:\n// function(filename, dir) { return result; }\n\n// Read lines in from a file until you hit the end\nvar f = new wrench.LineReader('x.txt');\nwhile(f.hasNextLine()) {\n\tutil.puts(f.getNextLine());\n}\n\n// Note: You will need to close that above line reader at some point, otherwise\n// you will run into a \"too many open files\" error. f.close() or fs.closeSync(f.fd) are\n// your friends, as only you know when it is safe to close.\n```\n\n### Asynchronous operations\n``` javascript\n// Recursively read directories contents\nvar files = [];\nwrench.readdirRecursive('my_directory_name', function(error, curFiles) {\n // curFiles is what you want\n});\n\n// If you're feeling somewhat masochistic\nwrench.copyDirRecursive(srcDir, newDir, {forceDelete: bool /* See sync version */}, callbackfn);\n```\n\nQuestions, comments? Hit me up. (ryan [at] venodesigns.net | http://twitter.com/ryanmcgrath)\n",
|
||||
"readmeFilename": "readme.md",
|
||||
"homepage": "https://github.com/ryanmcgrath/wrench-js",
|
||||
"_id": "wrench@1.3.9",
|
||||
"_shasum": "6f13ec35145317eb292ca5f6531391b244111411",
|
||||
"_from": "wrench@1.3.9",
|
||||
"_resolved": "https://registry.npmjs.org/wrench/-/wrench-1.3.9.tgz"
|
||||
"_id": "wrench@1.5.8",
|
||||
"_shasum": "7a31c97f7869246d76c5cf2f5c977a1c4c8e5ab5",
|
||||
"_from": "wrench@~1.5.8",
|
||||
"_resolved": "https://registry.npmjs.org/wrench/-/wrench-1.5.8.tgz"
|
||||
}
|
||||
|
||||
16
package.json
16
package.json
@ -13,17 +13,17 @@
|
||||
"url": "https://github.com/jsdoc3/jsdoc"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.1.22",
|
||||
"async": "~0.9.0",
|
||||
"catharsis": "~0.8.6",
|
||||
"escape-string-regexp": "~1.0.0",
|
||||
"escape-string-regexp": "~1.0.2",
|
||||
"esprima": "https://github.com/ariya/esprima/tarball/49a2eccb243f29bd653b11e9419241a9d726af7c",
|
||||
"js2xmlparser": "~0.1.0",
|
||||
"marked": "~0.3.1",
|
||||
"js2xmlparser": "~0.1.7",
|
||||
"marked": "~0.3.2",
|
||||
"requizzle": "~0.2.0",
|
||||
"strip-json-comments": "~0.1.3",
|
||||
"taffydb": "https://github.com/hegemonic/taffydb/tarball/master",
|
||||
"underscore": "~1.6.0",
|
||||
"wrench": "~1.3.9"
|
||||
"strip-json-comments": "~1.0.2",
|
||||
"taffydb": "https://github.com/hegemonic/taffydb/tarball/7d100bcee0e997ee4977e273cdce60bd8933050e",
|
||||
"underscore": "~1.7.0",
|
||||
"wrench": "~1.5.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "~0.11.0",
|
||||
|
||||
11
rhino/os.js
11
rhino/os.js
@ -1,3 +1,4 @@
|
||||
/*global java */
|
||||
/**
|
||||
* Partial Rhino implementation of Node.js' `os` module.
|
||||
* @module os
|
||||
@ -8,12 +9,6 @@
|
||||
|
||||
exports.EOL = String( java.lang.System.getProperty('line.separator') );
|
||||
|
||||
// clearly not accurate, but probably good enough
|
||||
exports.platform = function() {
|
||||
if ( String(java.lang.System.getProperty('os.name')).match(/^[Ww]in/) ) {
|
||||
return 'win32';
|
||||
}
|
||||
else {
|
||||
return 'linux';
|
||||
}
|
||||
};
|
||||
return process.platform;
|
||||
};
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/*global env: true, Packages: true */
|
||||
/*global env, java, Packages, version */
|
||||
/*eslint-disable strict */
|
||||
/**
|
||||
* @overview A minimal emulation of the standard features of Node.js necessary
|
||||
* to get JSDoc to run.
|
||||
@ -149,6 +150,15 @@ global.process = {
|
||||
nextTick: function nextTick(callback) {
|
||||
setTimeout(callback, 0);
|
||||
},
|
||||
platform: (function() {
|
||||
if ( String(java.lang.System.getProperty('os.name')).match(/^[Ww]in/) ) {
|
||||
return 'win32';
|
||||
}
|
||||
else {
|
||||
// not necessarily accurate, but good enough
|
||||
return 'linux';
|
||||
}
|
||||
})(),
|
||||
stderr: {
|
||||
// Java can't reliably find the terminal width across platforms, so we hard-code a
|
||||
// reasonable value
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user