update Catharsis (fixes #652 and #767)

This commit is contained in:
Jeff Williams 2014-10-08 10:57:25 -07:00
parent c083ab7bd1
commit 8238bc3e34
6 changed files with 206 additions and 155 deletions

File diff suppressed because one or more lines are too long

69
node_modules/catharsis/lib/schema.js generated vendored Normal file
View File

@ -0,0 +1,69 @@
'use strict';
var _ = require('underscore-contrib');
// JSON schema types
var ARRAY = 'array';
var BOOLEAN = 'boolean';
var OBJECT = 'object';
var STRING = 'string';
var UNDEFINED = 'undefined';
var TYPES = require('./types');
var TYPE_NAMES = _.values(TYPES);
module.exports = {
id: '#parsedType',
type: [OBJECT, UNDEFINED],
additionalProperties: false,
properties: {
type: {
type: STRING,
enum: TYPE_NAMES
},
// field type
key: { '$ref': '#parsedType' },
value: { '$ref': '#parsedType' },
// function type
params: {
type: ARRAY,
items: { '$ref': '#parsedType' }
},
'new': { '$ref': '#parsedType' },
'this': { '$ref': '#parsedType' },
result: {'$ref': '#parsedType' },
// name expression
name: STRING,
// record type
fields: {
type: ARRAY,
items: { '$ref': '#parsedType' }
},
// type application
expression: { '$ref': '#parsedType' },
applications: {
type: ARRAY,
minItems: 1,
maxItems: 2,
items: { '$ref': '#parsedType' }
},
// type union
elements: {
type: ARRAY,
minItems: 1,
items: { '$ref': '#parsedType' }
},
optional: BOOLEAN,
nullable: BOOLEAN,
repeatable: BOOLEAN,
reservedWord: BOOLEAN
},
required: [ 'type' ]
};

View File

@ -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, youll 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, thats 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"
}

View File

@ -1,117 +1,117 @@
// Underscore-contrib (underscore.array.selectors.js 0.3.0)
// (c) 2013 Michael Fogus, DocumentCloud and Investigative Reporters & Editors
// Underscore-contrib may be freely distributed under the MIT license.
(function(root) {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var _ = root._ || require('underscore');
// Helpers
// -------
// Create quick reference variables for speed access to core prototypes.
var slice = Array.prototype.slice,
concat = Array.prototype.concat;
var existy = function(x) { return x != null; };
var truthy = function(x) { return (x !== false) && existy(x); };
var isSeq = function(x) { return (_.isArray(x)) || (_.isArguments(x)); };
// Mixing in the array selectors
// ----------------------------
_.mixin({
// Returns the second element of an array. Passing **n** will return all but
// the first of the head N values in the array. The **guard** check allows it
// to work with `_.map`.
second: function(array, n, guard) {
if (array == null) return void 0;
return (n != null) && !guard ? slice.call(array, 1, n) : array[1];
},
// Returns the third element of an array. Passing **n** will return all but
// the first two of the head N values in the array. The **guard** check allows it
// to work with `_.map`.
third: function(array, n, guard) {
if (array == null) return void 0;
return (n != null) && !guard ? slice.call(array, 2, n) : array[2];
},
// A function to get at an index into an array
nth: function(array, index, guard) {
if ((index != null) && !guard) return array[index];
},
// Takes all items in an array while a given predicate returns truthy.
takeWhile: function(array, pred) {
if (!isSeq(array)) throw new TypeError;
var sz = _.size(array);
for (var index = 0; index < sz; index++) {
if(!truthy(pred(array[index]))) {
break;
}
}
return _.take(array, index);
},
// Drops all items from an array while a given predicate returns truthy.
dropWhile: function(array, pred) {
if (!isSeq(array)) throw new TypeError;
var sz = _.size(array);
for (var index = 0; index < sz; index++) {
if(!truthy(pred(array[index])))
break;
}
return _.drop(array, index);
},
// Returns an array with two internal arrays built from
// taking an original array and spliting it at the index
// where a given function goes falsey.
splitWith: function(array, pred) {
return [_.takeWhile(array, pred), _.dropWhile(array, pred)];
},
// Takes an array and partitions it as the given predicate changes
// truth sense.
partitionBy: function(array, fun){
if (_.isEmpty(array) || !existy(array)) return [];
var fst = _.first(array);
var fstVal = fun(fst);
var run = concat.call([fst], _.takeWhile(_.rest(array), function(e) {
return _.isEqual(fstVal, fun(e));
}));
return concat.call([run], _.partitionBy(_.drop(array, _.size(run)), fun));
},
// Returns the 'best' value in an array based on the result of a
// given function.
best: function(array, fun) {
return _.reduce(array, function(x, y) {
return fun(x, y) ? x : y;
});
},
// Returns an array of existy results of a function over an source array.
keep: function(array, fun) {
if (!isSeq(array)) throw new TypeError("expected an array as the first argument");
return _.filter(_.map(array, function(e) {
return fun(e);
}), existy);
}
});
})(this);
// Underscore-contrib (underscore.array.selectors.js 0.3.0)
// (c) 2013 Michael Fogus, DocumentCloud and Investigative Reporters & Editors
// Underscore-contrib may be freely distributed under the MIT license.
(function(root) {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `global` on the server.
var _ = root._ || require('underscore');
// Helpers
// -------
// Create quick reference variables for speed access to core prototypes.
var slice = Array.prototype.slice,
concat = Array.prototype.concat;
var existy = function(x) { return x != null; };
var truthy = function(x) { return (x !== false) && existy(x); };
var isSeq = function(x) { return (_.isArray(x)) || (_.isArguments(x)); };
// Mixing in the array selectors
// ----------------------------
_.mixin({
// Returns the second element of an array. Passing **n** will return all but
// the first of the head N values in the array. The **guard** check allows it
// to work with `_.map`.
second: function(array, n, guard) {
if (array == null) return void 0;
return (n != null) && !guard ? slice.call(array, 1, n) : array[1];
},
// Returns the third element of an array. Passing **n** will return all but
// the first two of the head N values in the array. The **guard** check allows it
// to work with `_.map`.
third: function(array, n, guard) {
if (array == null) return void 0;
return (n != null) && !guard ? slice.call(array, 2, n) : array[2];
},
// A function to get at an index into an array
nth: function(array, index, guard) {
if ((index != null) && !guard) return array[index];
},
// Takes all items in an array while a given predicate returns truthy.
takeWhile: function(array, pred) {
if (!isSeq(array)) throw new TypeError;
var sz = _.size(array);
for (var index = 0; index < sz; index++) {
if(!truthy(pred(array[index]))) {
break;
}
}
return _.take(array, index);
},
// Drops all items from an array while a given predicate returns truthy.
dropWhile: function(array, pred) {
if (!isSeq(array)) throw new TypeError;
var sz = _.size(array);
for (var index = 0; index < sz; index++) {
if(!truthy(pred(array[index])))
break;
}
return _.drop(array, index);
},
// Returns an array with two internal arrays built from
// taking an original array and spliting it at the index
// where a given function goes falsey.
splitWith: function(array, pred) {
return [_.takeWhile(array, pred), _.dropWhile(array, pred)];
},
// Takes an array and partitions it as the given predicate changes
// truth sense.
partitionBy: function(array, fun){
if (_.isEmpty(array) || !existy(array)) return [];
var fst = _.first(array);
var fstVal = fun(fst);
var run = concat.call([fst], _.takeWhile(_.rest(array), function(e) {
return _.isEqual(fstVal, fun(e));
}));
return concat.call([run], _.partitionBy(_.drop(array, _.size(run)), fun));
},
// Returns the 'best' value in an array based on the result of a
// given function.
best: function(array, fun) {
return _.reduce(array, function(x, y) {
return fun(x, y) ? x : y;
});
},
// Returns an array of existy results of a function over an source array.
keep: function(array, fun) {
if (!isSeq(array)) throw new TypeError("expected an array as the first argument");
return _.filter(_.map(array, function(e) {
return fun(e);
}), existy);
}
});
})(this);

21
node_modules/catharsis/package.json generated vendored

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
},
"dependencies": {
"async": "~0.1.22",
"catharsis": "~0.8.2",
"catharsis": "~0.8.3",
"escape-string-regexp": "~1.0.0",
"esprima": "https://github.com/ariya/esprima/tarball/49a2eccb243f29bd653b11e9419241a9d726af7c",
"js2xmlparser": "~0.1.0",