conjur-asset-ui-api 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +31 -0
- data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
- data/.gitignore +20 -0
- data/.overcommit.yml +5 -0
- data/.project +18 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +1 -0
- data/compile_ls +2 -0
- data/conjur-asset-ui.gemspec +36 -0
- data/lib/conjur-asset-ui-version.rb +7 -0
- data/lib/conjur-asset-ui.rb +7 -0
- data/lib/conjur/audit/follower.rb +63 -0
- data/lib/conjur/audit/humanizer.rb +53 -0
- data/lib/conjur/audit/tableizer.rb +55 -0
- data/lib/conjur/command/ui.rb +38 -0
- data/lib/conjur/webserver/api_proxy.rb +94 -0
- data/lib/conjur/webserver/audit_stream.rb +92 -0
- data/lib/conjur/webserver/authorize.rb +28 -0
- data/lib/conjur/webserver/conjur_info.rb +33 -0
- data/lib/conjur/webserver/home.rb +36 -0
- data/lib/conjur/webserver/login.rb +50 -0
- data/lib/conjur/webserver/server.rb +111 -0
- data/livescript/views/audit.ls +124 -0
- data/public/css/bootstrap.css +7 -0
- data/public/css/styles.less +400 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/images/conjur-logo.svg +26 -0
- data/public/images/icon-client-pc.svg +12 -0
- data/public/images/icon-environment.png +0 -0
- data/public/images/icon-person.svg +12 -0
- data/public/images/icon-service-dots.svg +13 -0
- data/public/images/icon-variable.png +0 -0
- data/public/index.html +121 -0
- data/public/js/lib/JSXTransformer.js +10862 -0
- data/public/js/lib/async.js +958 -0
- data/public/js/lib/backbone.js +2 -0
- data/public/js/lib/bootstrap.js +6 -0
- data/public/js/lib/date.extensions.js +141 -0
- data/public/js/lib/less.js +16 -0
- data/public/js/lib/moment.js +7768 -0
- data/public/js/lib/pace.js +2 -0
- data/public/js/lib/prelude-browser-min.js +1 -0
- data/public/js/lib/react-with-addons.js +15505 -0
- data/public/js/lib/react.js +14469 -0
- data/public/js/lib/sorted-set.no-require.js +1170 -0
- data/public/js/lib/sorted-set.no-require.js.txt +6 -0
- data/public/js/lib/underscore-min.js +6 -0
- data/public/js/lib/underscore.string.min.js +1 -0
- data/public/js/main.js +353 -0
- data/public/js/models/namespace.js +6 -0
- data/public/js/models/policyList.js +10 -0
- data/public/js/models/record.js +26 -0
- data/public/js/models/resourceList.js +61 -0
- data/public/js/models/userList.js +16 -0
- data/public/js/models/variableList.js +12 -0
- data/public/js/views/audit.js +191 -0
- data/public/js/views/dashboard.js +35 -0
- data/public/js/views/generic.js +42 -0
- data/public/js/views/group.js +32 -0
- data/public/js/views/groups.js +18 -0
- data/public/js/views/host.js +40 -0
- data/public/js/views/hosts.js +18 -0
- data/public/js/views/layer.js +63 -0
- data/public/js/views/layers.js +18 -0
- data/public/js/views/mixins/search.js +9 -0
- data/public/js/views/namespaces.js +40 -0
- data/public/js/views/navSearch.js +16 -0
- data/public/js/views/permissions.js +91 -0
- data/public/js/views/policies.js +17 -0
- data/public/js/views/policy.js +23 -0
- data/public/js/views/resource.js +23 -0
- data/public/js/views/role.js +18 -0
- data/public/js/views/searchResults.js +146 -0
- data/public/js/views/time.js +14 -0
- data/public/js/views/user.js +22 -0
- data/public/js/views/users.js +18 -0
- data/public/js/views/variable.js +41 -0
- data/public/js/views/variables.js +18 -0
- data/vendor/prelude-ls/.gitignore +2 -0
- data/vendor/prelude-ls/.travis.yml +3 -0
- data/vendor/prelude-ls/CHANGELOG.md +81 -0
- data/vendor/prelude-ls/LICENSE +22 -0
- data/vendor/prelude-ls/Makefile +50 -0
- data/vendor/prelude-ls/README.md +15 -0
- data/vendor/prelude-ls/browser/prelude-browser-min.js +1 -0
- data/vendor/prelude-ls/browser/prelude-browser.js +1172 -0
- data/vendor/prelude-ls/lib/Func.js +40 -0
- data/vendor/prelude-ls/lib/List.js +602 -0
- data/vendor/prelude-ls/lib/Num.js +129 -0
- data/vendor/prelude-ls/lib/Obj.js +153 -0
- data/vendor/prelude-ls/lib/Str.js +68 -0
- data/vendor/prelude-ls/lib/index.js +164 -0
- data/vendor/prelude-ls/package.json +50 -0
- data/vendor/prelude-ls/package.ls +46 -0
- data/vendor/prelude-ls/src/Func.ls +17 -0
- data/vendor/prelude-ls/src/List.ls +299 -0
- data/vendor/prelude-ls/src/Num.ls +83 -0
- data/vendor/prelude-ls/src/Obj.ls +61 -0
- data/vendor/prelude-ls/src/Str.ls +32 -0
- data/vendor/prelude-ls/src/index.ls +56 -0
- data/vendor/prelude-ls/test/Func.ls +36 -0
- data/vendor/prelude-ls/test/List.ls +751 -0
- data/vendor/prelude-ls/test/Num.ls +258 -0
- data/vendor/prelude-ls/test/Obj.ls +145 -0
- data/vendor/prelude-ls/test/Prelude.ls +49 -0
- data/vendor/prelude-ls/test/Str.ls +208 -0
- data/vendor/prelude-ls/test/browser.html +5 -0
- metadata +328 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
/** @jsx React.DOM */
|
2
|
+
|
3
|
+
var UserBox = React.createClass({
|
4
|
+
getInitialState: function() {
|
5
|
+
return { currentNamespace: "", members: [] };
|
6
|
+
},
|
7
|
+
render: function() {
|
8
|
+
return (
|
9
|
+
<div className="userBox">
|
10
|
+
<NamespaceFilter currentNamespace={this.state.currentNamespace} namespaces={this.props.data.namespaces} />
|
11
|
+
<div className="userList">
|
12
|
+
<h2>Users</h2>
|
13
|
+
<GenericList data={{kind: "users", members: this.state.members}} />
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
);
|
17
|
+
}
|
18
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/** @jsx React.DOM */
|
2
|
+
|
3
|
+
var Variable = React.createClass({
|
4
|
+
render: function() {
|
5
|
+
var updaters = this.props.data.updaters.map(function (member) {
|
6
|
+
return <li>
|
7
|
+
<RoleLink id={member} />
|
8
|
+
</li>
|
9
|
+
}.bind(this));
|
10
|
+
var fetchers = this.props.data.fetchers.map(function (member) {
|
11
|
+
return <li>
|
12
|
+
<RoleLink id={member} />
|
13
|
+
</li>
|
14
|
+
}.bind(this));
|
15
|
+
var resourceId = [ conjurConfiguration.account, 'variable', this.props.data.variable.id ].join(':')
|
16
|
+
return (
|
17
|
+
<div className="variable">
|
18
|
+
<h2>Variable {this.props.data.variable.id}</h2>
|
19
|
+
<dl>
|
20
|
+
<dt>Owner</dt>
|
21
|
+
<dd><RoleLink id={this.props.data.variable.ownerid}/></dd>
|
22
|
+
<dt>Updaters</dt>
|
23
|
+
<dd>
|
24
|
+
<ul>
|
25
|
+
{updaters}
|
26
|
+
</ul>
|
27
|
+
</dd>
|
28
|
+
<dt>Fetchers</dt>
|
29
|
+
<dd>
|
30
|
+
<ul>
|
31
|
+
{fetchers}
|
32
|
+
</ul>
|
33
|
+
</dd>
|
34
|
+
</dl>
|
35
|
+
<div className="audit auditVariable">
|
36
|
+
<AuditBox resources={[resourceId]}/>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
);
|
40
|
+
}
|
41
|
+
});
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/** @jsx React.DOM */
|
2
|
+
|
3
|
+
var VariableBox = React.createClass({
|
4
|
+
getInitialState: function() {
|
5
|
+
return { currentNamespace: "", members: [] };
|
6
|
+
},
|
7
|
+
render: function() {
|
8
|
+
return (
|
9
|
+
<div className="groupBox">
|
10
|
+
<NamespaceFilter currentNamespace={this.state.currentNamespace} namespaces={this.props.data.namespaces} />
|
11
|
+
<div className="groupList">
|
12
|
+
<h2>Variables</h2>
|
13
|
+
<GenericList data={{kind: "variables", members: this.state.members}} />
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
);
|
17
|
+
}
|
18
|
+
});
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# 1.0.3
|
2
|
+
- build browser versions
|
3
|
+
|
4
|
+
# 1.0.2
|
5
|
+
- bug fix for `flatten` - slight change with bug fix, flattens arrays only, not array-like objects
|
6
|
+
|
7
|
+
# 1.0.1
|
8
|
+
- bug fixes for `drop-while` and `take-while`
|
9
|
+
|
10
|
+
# 1.0.0
|
11
|
+
* massive update - separated functions into separate modules
|
12
|
+
* functions do not accept multiple types anymore - use different versions in their respective modules in some cases (eg. `Obj.map`), or use `chars` or `values` in other cases to transform into a list
|
13
|
+
* objects are no longer transformed into functions, simply use `(obj.)` in LiveScript to do that
|
14
|
+
* browser version now using browserify - use `prelude = require('prelude-ls')`
|
15
|
+
* added `compact`, `split`, `flatten`, `difference`, `intersection`, `union`, `count-by`, `group-by`, `chars`, `unchars`, `apply`
|
16
|
+
* added `lists-to-obj` which takes a list of keys and list of values and zips them up into an object, and the converse `obj-to-lists`
|
17
|
+
* added `pairs-to-obj` which takes a list of pairs (2 element lists) and creates an object, and the converse `obj-to-pairs`
|
18
|
+
* removed `cons`, `append` - use the concat operator
|
19
|
+
* removed `compose` - use the compose operator
|
20
|
+
* removed `obj-to-func` - use partially applied access (eg. `(obj.)`)
|
21
|
+
* removed `length` - use `(.length)`
|
22
|
+
* `sort-by` renamed to `sort-with`
|
23
|
+
* added new `sort-by`
|
24
|
+
* removed `compare` - just use the new `sort-by`
|
25
|
+
* `break-it` renamed `break-list`, (`Str.break-str` for the string version)
|
26
|
+
* added `Str.repeat` which creates a new string by repeating the input n times
|
27
|
+
* `unfold` as alias to `unfoldr` is no longer used
|
28
|
+
* fixed up style and compiled with LiveScript 1.1.1
|
29
|
+
* use Make instead of Slake
|
30
|
+
* greatly improved tests
|
31
|
+
|
32
|
+
# 0.6.0
|
33
|
+
* fixed various bugs
|
34
|
+
* added `fix`, a fixpoint (Y combinator) for anonymous recursive functions
|
35
|
+
* added `unfoldr` (alias `unfold`)
|
36
|
+
* calling `replicate` with a string now returns a list of strings
|
37
|
+
* removed `partial`, just use native partial application in LiveScript using the `_` placeholder, or currying
|
38
|
+
* added `sort`, `sortBy`, and `compare`
|
39
|
+
|
40
|
+
# 0.5.0
|
41
|
+
* removed `lookup` - use (.prop)
|
42
|
+
* removed `call` - use (.func arg1, arg2)
|
43
|
+
* removed `pluck` - use map (.prop), xs
|
44
|
+
* fixed buys wtih `head` and `last`
|
45
|
+
* added non-minifed browser version, as `prelude-browser.js`
|
46
|
+
* renamed `prelude-min.js` to `prelude-browser-min.js`
|
47
|
+
* renamed `zip` to `zipAll`
|
48
|
+
* renamed `zipWith` to `zipAllWith`
|
49
|
+
* added `zip`, a curried zip that takes only two arguments
|
50
|
+
* added `zipWith`, a curried zipWith that takes only two arguments
|
51
|
+
|
52
|
+
# 0.4.0
|
53
|
+
* added `parition` function
|
54
|
+
* added `curry` function
|
55
|
+
* removed `elem` function (use `in`)
|
56
|
+
* removed `notElem` function (use `not in`)
|
57
|
+
|
58
|
+
# 0.3.0
|
59
|
+
* added `listToObject`
|
60
|
+
* added `unique`
|
61
|
+
* added `objToFunc`
|
62
|
+
* added support for using strings in map and the like
|
63
|
+
* added support for using objects in map and the like
|
64
|
+
* added ability to use objects instead of functions in certain cases
|
65
|
+
* removed `error` (just use throw)
|
66
|
+
* added `tau` constant
|
67
|
+
* added `join`
|
68
|
+
* added `values`
|
69
|
+
* added `keys`
|
70
|
+
* added `partial`
|
71
|
+
* renamed `log` to `ln`
|
72
|
+
* added alias to `head`: `first`
|
73
|
+
* added `installPrelude` helper
|
74
|
+
|
75
|
+
# 0.2.0
|
76
|
+
* removed functions that simply warp operators as you can now use operators as functions in LiveScript
|
77
|
+
* `min/max` are now curried and take only 2 arguments
|
78
|
+
* added `call`
|
79
|
+
|
80
|
+
# 0.1.0
|
81
|
+
* initial public release
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 George Zahariev
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
default: all
|
2
|
+
|
3
|
+
SRC = $(shell find src -name "*.ls" -type f | sort)
|
4
|
+
LIB = $(SRC:src/%.ls=lib/%.js)
|
5
|
+
LS = node_modules/LiveScript
|
6
|
+
LSC = node_modules/.bin/lsc
|
7
|
+
BROWSERIFY = node_modules/.bin/browserify
|
8
|
+
UGLIFYJS = node_modules/.bin/uglifyjs
|
9
|
+
MOCHA = node_modules/.bin/mocha
|
10
|
+
|
11
|
+
lib:
|
12
|
+
mkdir lib/
|
13
|
+
|
14
|
+
lib/%.js: src/%.ls lib
|
15
|
+
$(LSC) --compile --bare --print "$<" > "$@"
|
16
|
+
|
17
|
+
browser:
|
18
|
+
mkdir browser/
|
19
|
+
|
20
|
+
prelude-browser.js: $(LIB) browser
|
21
|
+
$(BROWSERIFY) -r ./lib/index.js:prelude-ls > browser/prelude-browser.js
|
22
|
+
|
23
|
+
prelude-browser-min.js: browser/prelude-browser.js
|
24
|
+
$(UGLIFYJS) browser/prelude-browser.js --mangle --comments "all" > browser/prelude-browser-min.js
|
25
|
+
|
26
|
+
package.json: package.ls
|
27
|
+
$(LSC) --compile --json package.ls
|
28
|
+
|
29
|
+
.PHONY: build-browser test install loc clean
|
30
|
+
|
31
|
+
all: build
|
32
|
+
|
33
|
+
build: $(LIB) package.json
|
34
|
+
|
35
|
+
build-browser: prelude-browser.js prelude-browser-min.js
|
36
|
+
|
37
|
+
test: build
|
38
|
+
$(MOCHA) --reporter dot --ui tdd --compilers ls:$(LS)
|
39
|
+
|
40
|
+
dev-install:
|
41
|
+
npm install .
|
42
|
+
|
43
|
+
loc:
|
44
|
+
wc --lines src/*
|
45
|
+
|
46
|
+
clean:
|
47
|
+
rm --force ./*.js
|
48
|
+
rm --force --recursive lib
|
49
|
+
rm --force --recursive browser
|
50
|
+
rm --force package.json
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# prelude.ls [![Build Status](https://travis-ci.org/gkz/prelude-ls.png?branch=master)](https://travis-ci.org/gkz/prelude-ls)
|
2
|
+
|
3
|
+
is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, <a href="http://livescript.net">LiveScript</a>.
|
4
|
+
|
5
|
+
See **[the prelude.ls site](http://preludels.com)** for examples, a reference, and more.
|
6
|
+
|
7
|
+
You can install via npm `npm install prelude-ls`
|
8
|
+
|
9
|
+
### Development
|
10
|
+
|
11
|
+
`make test` to test
|
12
|
+
|
13
|
+
`make build` to build `lib` from `src`
|
14
|
+
|
15
|
+
`make build-browser` to build browser versions
|
@@ -0,0 +1 @@
|
|
1
|
+
require=function(n,r,t){function e(t,i){if(!r[t]){if(!n[t]){var o=typeof require=="function"&&require;if(!i&&o)return o(t,!0);if(u)return u(t,!0);throw new Error("Cannot find module '"+t+"'")}var a=r[t]={exports:{}};n[t][0].call(a.exports,function(r){var u=n[t][1][r];return e(u?u:r)},a,a.exports)}return r[t].exports}var u=typeof require=="function"&&require;for(var i=0;i<t.length;i++)e(t[i]);return e}({"prelude-ls":[function(n,r,t){r.exports=n("bcmc1g")},{}],bcmc1g:[function(n,r,t){var e,u,i,o,a,c,f,l,s,h={}.toString;e=n("./Func.js");u=n("./List.js");i=n("./Obj.js");o=n("./Str.js");a=n("./Num.js");c=function(n){return n};f=p(function(n,r){return h.call(r).slice(8,-1)===n});l=p(function(n,r){var t,e=[];for(t=0;t<n;++t){e.push(r)}return e});o.empty=u.empty;o.slice=u.slice;o.take=u.take;o.drop=u.drop;o.splitAt=u.splitAt;o.takeWhile=u.takeWhile;o.dropWhile=u.dropWhile;o.span=u.span;o.breakStr=u.breakList;s={Func:e,List:u,Obj:i,Str:o,Num:a,id:c,isType:f,replicate:l};s.each=u.each;s.map=u.map;s.filter=u.filter;s.compact=u.compact;s.reject=u.reject;s.partition=u.partition;s.find=u.find;s.head=u.head;s.first=u.first;s.tail=u.tail;s.last=u.last;s.initial=u.initial;s.empty=u.empty;s.reverse=u.reverse;s.difference=u.difference;s.intersection=u.intersection;s.union=u.union;s.countBy=u.countBy;s.groupBy=u.groupBy;s.fold=u.fold;s.foldl=u.foldl;s.fold1=u.fold1;s.foldl1=u.foldl1;s.foldr=u.foldr;s.foldr1=u.foldr1;s.unfoldr=u.unfoldr;s.andList=u.andList;s.orList=u.orList;s.any=u.any;s.all=u.all;s.unique=u.unique;s.sort=u.sort;s.sortWith=u.sortWith;s.sortBy=u.sortBy;s.sum=u.sum;s.product=u.product;s.mean=u.mean;s.average=u.average;s.concat=u.concat;s.concatMap=u.concatMap;s.flatten=u.flatten;s.maximum=u.maximum;s.minimum=u.minimum;s.scan=u.scan;s.scanl=u.scanl;s.scan1=u.scan1;s.scanl1=u.scanl1;s.scanr=u.scanr;s.scanr1=u.scanr1;s.slice=u.slice;s.take=u.take;s.drop=u.drop;s.splitAt=u.splitAt;s.takeWhile=u.takeWhile;s.dropWhile=u.dropWhile;s.span=u.span;s.breakList=u.breakList;s.zip=u.zip;s.zipWith=u.zipWith;s.zipAll=u.zipAll;s.zipAllWith=u.zipAllWith;s.apply=e.apply;s.curry=e.curry;s.flip=e.flip;s.fix=e.fix;s.split=o.split;s.join=o.join;s.lines=o.lines;s.unlines=o.unlines;s.words=o.words;s.unwords=o.unwords;s.chars=o.chars;s.unchars=o.unchars;s.values=i.values;s.keys=i.keys;s.pairsToObj=i.pairsToObj;s.objToPairs=i.objToPairs;s.listsToObj=i.listsToObj;s.objToLists=i.objToLists;s.max=a.max;s.min=a.min;s.negate=a.negate;s.abs=a.abs;s.signum=a.signum;s.quot=a.quot;s.rem=a.rem;s.div=a.div;s.mod=a.mod;s.recip=a.recip;s.pi=a.pi;s.tau=a.tau;s.exp=a.exp;s.sqrt=a.sqrt;s.ln=a.ln;s.pow=a.pow;s.sin=a.sin;s.tan=a.tan;s.cos=a.cos;s.acos=a.acos;s.asin=a.asin;s.atan=a.atan;s.atan2=a.atan2;s.truncate=a.truncate;s.round=a.round;s.ceiling=a.ceiling;s.floor=a.floor;s.isItNaN=a.isItNaN;s.even=a.even;s.odd=a.odd;s.gcd=a.gcd;s.lcm=a.lcm;s.VERSION="1.0.3";r.exports=s;function p(n,r){var t,e=function(u){return n.length>1?function(){var i=u?u.concat():[];t=r?t||this:this;return i.push.apply(i,arguments)<n.length&&arguments.length?e.call(t,i):n.apply(t,i)}:n};return e()}},{"./Func.js":1,"./Obj.js":2,"./Num.js":3,"./List.js":4,"./Str.js":5}],1:[function(n,r,t){var e,u,i,o;e=function(n){return a(n)};u=a(function(n,r,t){return n(t,r)});i=function(n){return function(r,t){return function(){return n(r(r)).apply(null,arguments)}}(function(r,t){return function(){return n(r(r)).apply(null,arguments)}})};o=a(function(n,r){return n.apply(null,r)});r.exports={curry:e,flip:u,fix:i,apply:o};function a(n,r){var t,e=function(u){return n.length>1?function(){var i=u?u.concat():[];t=r?t||this:this;return i.push.apply(i,arguments)<n.length&&arguments.length?e.call(t,i):n.apply(t,i)}:n};return e()}},{}],2:[function(n,r,t){var e,u,i,o,a,c,f,l,s,h,p,g,v,m;e=function(n){var r,t,e=[];for(r in n){t=n[r];e.push(t)}return e};u=function(n){var r,t=[];for(r in n){t.push(r)}return t};i=function(n){var r,t,e,u={};for(r=0,t=n.length;r<t;++r){e=n[r];u[e[0]]=e[1]}return u};o=function(n){var r,t,e=[];for(r in n){t=n[r];e.push([r,t])}return e};a=d(function(n,r){var t,e,u,i,o={};for(t=0,e=n.length;t<e;++t){u=t;i=n[t];o[i]=r[u]}return o});c=function(n){var r,t,e,u;r=[];t=[];for(e in n){u=n[e];r.push(e);t.push(u)}return[r,t]};f=function(n){var r;for(r in n){return false}return true};l=d(function(n,r){var t,e;for(t in r){e=r[t];n(e)}return r});s=d(function(n,r){var t,e,u={};for(t in r){e=r[t];u[t]=n(e)}return u});h=d(function(n){var r,t,e={};for(r in n){t=n[r];if(t){e[r]=t}}return e});p=d(function(n,r){var t,e,u={};for(t in r){e=r[t];if(n(e)){u[t]=e}}return u});g=d(function(n,r){var t,e,u={};for(t in r){e=r[t];if(!n(e)){u[t]=e}}return u});v=d(function(n,r){var t,e,u,i;t={};e={};for(u in r){i=r[u];(n(i)?t:e)[u]=i}return[t,e]});m=d(function(n,r){var t,e;for(t in r){e=r[t];if(n(e)){return e}}});r.exports={values:e,keys:u,pairsToObj:i,objToPairs:o,listsToObj:a,objToLists:c,empty:f,each:l,map:s,filter:p,compact:h,reject:g,partition:v,find:m};function d(n,r){var t,e=function(u){return n.length>1?function(){var i=u?u.concat():[];t=r?t||this:this;return i.push.apply(i,arguments)<n.length&&arguments.length?e.call(t,i):n.apply(t,i)}:n};return e()}},{}],3:[function(n,r,t){var e,u,i,o,a,c,f,l,s,h,p,g,v,m,d,y,j,b,x,M,k,W,w,L,q,T,z,A,N,O,B,S;e=I(function(n,r){return n>r?n:r});u=I(function(n,r){return n<r?n:r});i=function(n){return-n};o=Math.abs;a=function(n){if(n<0){return-1}else if(n>0){return 1}else{return 0}};c=I(function(n,r){return~~(n/r)});f=I(function(n,r){return n%r});l=I(function(n,r){return Math.floor(n/r)});s=I(function(n,r){var t;return(n%(t=r)+t)%t});h=function(n){return 1/n};p=Math.PI;g=p*2;v=Math.exp;m=Math.sqrt;d=Math.log;y=I(function(n,r){return Math.pow(n,r)});j=Math.sin;b=Math.tan;x=Math.cos;M=Math.asin;k=Math.acos;W=Math.atan;w=I(function(n,r){return Math.atan2(n,r)});L=function(n){return~~n};q=Math.round;T=Math.ceil;z=Math.floor;A=function(n){return n!==n};N=function(n){return n%2===0};O=function(n){return n%2!==0};B=I(function(n,r){var t;n=Math.abs(n);r=Math.abs(r);while(r!==0){t=n%r;n=r;r=t}return n});S=I(function(n,r){return Math.abs(Math.floor(n/B(n,r)*r))});r.exports={max:e,min:u,negate:i,abs:o,signum:a,quot:c,rem:f,div:l,mod:s,recip:h,pi:p,tau:g,exp:v,sqrt:m,ln:d,pow:y,sin:j,tan:b,cos:x,acos:k,asin:M,atan:W,atan2:w,truncate:L,round:q,ceiling:T,floor:z,isItNaN:A,even:N,odd:O,gcd:B,lcm:S};function I(n,r){var t,e=function(u){return n.length>1?function(){var i=u?u.concat():[];t=r?t||this:this;return i.push.apply(i,arguments)<n.length&&arguments.length?e.call(t,i):n.apply(t,i)}:n};return e()}},{}],4:[function(n,r,t){var e,u,i,o,a,c,f,l,s,h,p,g,v,m,d,y,j,b,x,M,k,W,w,L,q,T,z,A,N,O,B,S,I,P,F,E,C,R,V,D,G,H,J,K,Q,U,X,Y,Z,$,_,nr,rr,tr,er,ur,ir,or,ar,cr,fr,lr={}.toString,sr=[].slice;e=hr(function(n,r){var t,e,u;for(t=0,e=r.length;t<e;++t){u=r[t];n(u)}return r});u=hr(function(n,r){var t,e,u,i=[];for(t=0,e=r.length;t<e;++t){u=r[t];i.push(n(u))}return i});i=hr(function(n){var r,t,e,u=[];for(r=0,t=n.length;r<t;++r){e=n[r];if(e){u.push(e)}}return u});o=hr(function(n,r){var t,e,u,i=[];for(t=0,e=r.length;t<e;++t){u=r[t];if(n(u)){i.push(u)}}return i});a=hr(function(n,r){var t,e,u,i=[];for(t=0,e=r.length;t<e;++t){u=r[t];if(!n(u)){i.push(u)}}return i});c=hr(function(n,r){var t,e,u,i,o;t=[];e=[];for(u=0,i=r.length;u<i;++u){o=r[u];(n(o)?t:e).push(o)}return[t,e]});f=hr(function(n,r){var t,e,u;for(t=0,e=r.length;t<e;++t){u=r[t];if(n(u)){return u}}});l=s=function(n){if(!n.length){return}return n[0]};h=function(n){if(!n.length){return}return n.slice(1)};p=function(n){if(!n.length){return}return n[n.length-1]};g=function(n){var r;r=n.length;if(!r){return}return n.slice(0,r-1)};v=function(n){return!n.length};m=function(n){return n.concat().reverse()};d=function(n){var r,t,e,u;r=[];for(t=0,e=n.length;t<e;++t){u=n[t];if(!pr(u,r)){r.push(u)}}return r};y=j=hr(function(n,r,t){var e,u,i;for(e=0,u=t.length;e<u;++e){i=t[e];r=n(r,i)}return r});b=x=hr(function(n,r){return y(n,r[0],r.slice(1))});M=hr(function(n,r,t){return y(n,r,t.concat().reverse())});k=hr(function(n,r){var t;t=r.concat().reverse();return y(n,t[0],t.slice(1))});W=hr(function(n,r){var t,e,u;t=[];e=r;while((u=n(e))!=null){t.push(u[0]);e=u[1]}return t});w=function(n){return[].concat.apply([],n)};L=hr(function(n,r){var t;return[].concat.apply([],function(){var e,u,i,o=[];for(e=0,i=(u=r).length;e<i;++e){t=u[e];o.push(n(t))}return o}())});q=hr(function(n){var r;return[].concat.apply([],function(){var t,e,u,i=[];for(t=0,u=(e=n).length;t<u;++t){r=e[t];if(lr.call(r).slice(8,-1)==="Array"){i.push(q(r))}else{i.push(r)}}return i}())});T=function(n){var r,t,e,u,i,o,a,c;r=sr.call(arguments,1);t=[];n:for(e=0,u=n.length;e<u;++e){i=n[e];for(o=0,a=r.length;o<a;++o){c=r[o];if(pr(i,c)){continue n}}t.push(i)}return t};z=function(n){var r,t,e,u,i,o,a,c;r=sr.call(arguments,1);t=[];n:for(e=0,u=n.length;e<u;++e){i=n[e];for(o=0,a=r.length;o<a;++o){c=r[o];if(!pr(i,c)){continue n}}t.push(i)}return t};A=function(){var n,r,t,e,u,i,o,a;n=sr.call(arguments);r=[];for(t=0,e=n.length;t<e;++t){u=n[t];for(i=0,o=u.length;i<o;++i){a=u[i];if(!pr(a,r)){r.push(a)}}}return r};N=hr(function(n,r){var t,e,u,i,o;t={};for(e=0,u=r.length;e<u;++e){i=r[e];o=n(i);if(o in t){t[o]+=1}else{t[o]=1}}return t});O=hr(function(n,r){var t,e,u,i,o;t={};for(e=0,u=r.length;e<u;++e){i=r[e];o=n(i);if(o in t){t[o].push(i)}else{t[o]=[i]}}return t});B=function(n){var r,t,e;for(r=0,t=n.length;r<t;++r){e=n[r];if(!e){return false}}return true};S=function(n){var r,t,e;for(r=0,t=n.length;r<t;++r){e=n[r];if(e){return true}}return false};I=hr(function(n,r){var t,e,u;for(t=0,e=r.length;t<e;++t){u=r[t];if(n(u)){return true}}return false});P=hr(function(n,r){var t,e,u;for(t=0,e=r.length;t<e;++t){u=r[t];if(!n(u)){return false}}return true});F=function(n){return n.concat().sort(function(n,r){if(n>r){return 1}else if(n<r){return-1}else{return 0}})};E=hr(function(n,r){if(!r.length){return[]}return r.concat().sort(n)});C=hr(function(n,r){if(!r.length){return[]}return r.concat().sort(function(r,t){if(n(r)>n(t)){return 1}else if(n(r)<n(t)){return-1}else{return 0}})});R=function(n){var r,t,e,u;r=0;for(t=0,e=n.length;t<e;++t){u=n[t];r+=u}return r};V=function(n){var r,t,e,u;r=1;for(t=0,e=n.length;t<e;++t){u=n[t];r*=u}return r};D=G=function(n){var r,t,e,u;r=0;t=n.length;for(e=0;e<t;++e){u=e;r+=n[u]}return r/t};H=function(n){var r,t,e,u,i;r=n[0];for(t=0,u=(e=n.slice(1)).length;t<u;++t){i=e[t];if(i>r){r=i}}return r};J=function(n){var r,t,e,u,i;r=n[0];for(t=0,u=(e=n.slice(1)).length;t<u;++t){i=e[t];if(i<r){r=i}}return r};K=Q=hr(function(n,r,t){var e,u;e=r;return[r].concat(function(){var r,i,o,a=[];for(r=0,o=(i=t).length;r<o;++r){u=i[r];a.push(e=n(e,u))}return a}())});U=X=hr(function(n,r){if(!r.length){return}return K(n,r[0],r.slice(1))});Y=hr(function(n,r,t){t=t.concat().reverse();return K(n,r,t).reverse()});Z=hr(function(n,r){if(!r.length){return}r=r.concat().reverse();return K(n,r[0],r.slice(1)).reverse()});$=hr(function(n,r,t){return t.slice(n,r)});_=hr(function(n,r){if(n<=0){return r.slice(0,0)}else if(!r.length){return r}else{return r.slice(0,n)}});nr=hr(function(n,r){if(n<=0||!r.length){return r}else{return r.slice(n)}});rr=hr(function(n,r){return[_(n,r),nr(n,r)]});tr=hr(function(n,r){var t,e;t=r.length;if(!t){return r}e=0;while(e<t&&n(r[e])){e+=1}return r.slice(0,e)});er=hr(function(n,r){var t,e;t=r.length;if(!t){return r}e=0;while(e<t&&n(r[e])){e+=1}return r.slice(e)});ur=hr(function(n,r){return[tr(n,r),er(n,r)]});ir=hr(function(n,r){return ur(gr([vr,n]),r)});or=hr(function(n,r){var t,e,u,i,o,a;t=[];e=r.length;for(u=0,i=n.length;u<i;++u){o=u;a=n[u];if(o===e){break}t.push([a,r[o]])}return t});ar=hr(function(n,r,t){var e,u,i,o,a,c;e=[];u=t.length;for(i=0,o=r.length;i<o;++i){a=i;c=r[i];if(a===u){break}e.push(n(c,t[a]))}return e});cr=function(){var n,r,t,e,u,i,o,a,c,f=[];n=sr.call(arguments);r=9e9;for(t=0,e=n.length;t<e;++t){u=n[t];r<=(i=u.length)||(r=i)}for(t=0;t<r;++t){o=t;a=[];for(c=0,e=n.length;c<e;++c){u=n[c];a.push(u[o])}f.push(a)}return f};fr=function(n){var r,t,e,u,i,o,a,c=[];r=sr.call(arguments,1);t=9e9;for(e=0,u=r.length;e<u;++e){i=r[e];t<=(o=i.length)||(t=o)}for(e=0;e<t;++e){a=e;c.push(n.apply(null,f()))}return c;function f(){var n,t,e,u=[];for(n=0,e=(t=r).length;n<e;++n){i=t[n];u.push(i[a])}return u}};r.exports={each:e,map:u,filter:o,compact:i,reject:a,partition:c,find:f,head:l,first:s,tail:h,last:p,initial:g,empty:v,reverse:m,difference:T,intersection:z,union:A,countBy:N,groupBy:O,fold:y,fold1:b,foldl:j,foldl1:x,foldr:M,foldr1:k,unfoldr:W,andList:B,orList:S,any:I,all:P,unique:d,sort:F,sortWith:E,sortBy:C,sum:R,product:V,mean:D,average:G,concat:w,concatMap:L,flatten:q,maximum:H,minimum:J,scan:K,scan1:U,scanl:Q,scanl1:X,scanr:Y,scanr1:Z,slice:$,take:_,drop:nr,splitAt:rr,takeWhile:tr,dropWhile:er,span:ur,breakList:ir,zip:or,zipWith:ar,zipAll:cr,zipAllWith:fr};function hr(n,r){var t,e=function(u){return n.length>1?function(){var i=u?u.concat():[];t=r?t||this:this;return i.push.apply(i,arguments)<n.length&&arguments.length?e.call(t,i):n.apply(t,i)}:n};return e()}function pr(n,r){var t=-1,e=r.length>>>0;while(++t<e)if(n===r[t]&&t in r)return true;return false}function gr(n){return function(){var r,t=arguments;for(r=n.length;r>0;--r){t=[n[r-1].apply(this,t)]}return t[0]}}function vr(n){return!n}},{}],5:[function(n,r,t){var e,u,i,o,a,c,f,l,s,h;e=p(function(n,r){return r.split(n)});u=p(function(n,r){return r.join(n)});i=function(n){if(!n.length){return[]}return n.split("\n")};o=function(n){return n.join("\n")};a=function(n){if(!n.length){return[]}return n.split(/[ ]+/)};c=function(n){return n.join(" ")};f=function(n){return n.split("")};l=function(n){return n.join("")};s=function(n){return n.split("").reverse().join("")};h=p(function(n,r){var t,e,u;e=[];for(u=0;u<n;++u){e.push(r)}t=e;return t.join("")});r.exports={split:e,join:u,lines:i,unlines:o,words:a,unwords:c,chars:f,unchars:l,reverse:s,repeat:h};function p(n,r){var t,e=function(u){return n.length>1?function(){var i=u?u.concat():[];t=r?t||this:this;return i.push.apply(i,arguments)<n.length&&arguments.length?e.call(t,i):n.apply(t,i)}:n};return e()}},{}]},{},[]);
|
@@ -0,0 +1,1172 @@
|
|
1
|
+
require=(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({"prelude-ls":[function(require,module,exports){
|
2
|
+
module.exports=require('bcmc1g');
|
3
|
+
},{}],"bcmc1g":[function(require,module,exports){
|
4
|
+
var Func, List, Obj, Str, Num, id, isType, replicate, prelude, toString$ = {}.toString;
|
5
|
+
Func = require('./Func.js');
|
6
|
+
List = require('./List.js');
|
7
|
+
Obj = require('./Obj.js');
|
8
|
+
Str = require('./Str.js');
|
9
|
+
Num = require('./Num.js');
|
10
|
+
id = function(x){
|
11
|
+
return x;
|
12
|
+
};
|
13
|
+
isType = curry$(function(type, x){
|
14
|
+
return toString$.call(x).slice(8, -1) === type;
|
15
|
+
});
|
16
|
+
replicate = curry$(function(n, x){
|
17
|
+
var i$, results$ = [];
|
18
|
+
for (i$ = 0; i$ < n; ++i$) {
|
19
|
+
results$.push(x);
|
20
|
+
}
|
21
|
+
return results$;
|
22
|
+
});
|
23
|
+
Str.empty = List.empty;
|
24
|
+
Str.slice = List.slice;
|
25
|
+
Str.take = List.take;
|
26
|
+
Str.drop = List.drop;
|
27
|
+
Str.splitAt = List.splitAt;
|
28
|
+
Str.takeWhile = List.takeWhile;
|
29
|
+
Str.dropWhile = List.dropWhile;
|
30
|
+
Str.span = List.span;
|
31
|
+
Str.breakStr = List.breakList;
|
32
|
+
prelude = {
|
33
|
+
Func: Func,
|
34
|
+
List: List,
|
35
|
+
Obj: Obj,
|
36
|
+
Str: Str,
|
37
|
+
Num: Num,
|
38
|
+
id: id,
|
39
|
+
isType: isType,
|
40
|
+
replicate: replicate
|
41
|
+
};
|
42
|
+
prelude.each = List.each;
|
43
|
+
prelude.map = List.map;
|
44
|
+
prelude.filter = List.filter;
|
45
|
+
prelude.compact = List.compact;
|
46
|
+
prelude.reject = List.reject;
|
47
|
+
prelude.partition = List.partition;
|
48
|
+
prelude.find = List.find;
|
49
|
+
prelude.head = List.head;
|
50
|
+
prelude.first = List.first;
|
51
|
+
prelude.tail = List.tail;
|
52
|
+
prelude.last = List.last;
|
53
|
+
prelude.initial = List.initial;
|
54
|
+
prelude.empty = List.empty;
|
55
|
+
prelude.reverse = List.reverse;
|
56
|
+
prelude.difference = List.difference;
|
57
|
+
prelude.intersection = List.intersection;
|
58
|
+
prelude.union = List.union;
|
59
|
+
prelude.countBy = List.countBy;
|
60
|
+
prelude.groupBy = List.groupBy;
|
61
|
+
prelude.fold = List.fold;
|
62
|
+
prelude.foldl = List.foldl;
|
63
|
+
prelude.fold1 = List.fold1;
|
64
|
+
prelude.foldl1 = List.foldl1;
|
65
|
+
prelude.foldr = List.foldr;
|
66
|
+
prelude.foldr1 = List.foldr1;
|
67
|
+
prelude.unfoldr = List.unfoldr;
|
68
|
+
prelude.andList = List.andList;
|
69
|
+
prelude.orList = List.orList;
|
70
|
+
prelude.any = List.any;
|
71
|
+
prelude.all = List.all;
|
72
|
+
prelude.unique = List.unique;
|
73
|
+
prelude.sort = List.sort;
|
74
|
+
prelude.sortWith = List.sortWith;
|
75
|
+
prelude.sortBy = List.sortBy;
|
76
|
+
prelude.sum = List.sum;
|
77
|
+
prelude.product = List.product;
|
78
|
+
prelude.mean = List.mean;
|
79
|
+
prelude.average = List.average;
|
80
|
+
prelude.concat = List.concat;
|
81
|
+
prelude.concatMap = List.concatMap;
|
82
|
+
prelude.flatten = List.flatten;
|
83
|
+
prelude.maximum = List.maximum;
|
84
|
+
prelude.minimum = List.minimum;
|
85
|
+
prelude.scan = List.scan;
|
86
|
+
prelude.scanl = List.scanl;
|
87
|
+
prelude.scan1 = List.scan1;
|
88
|
+
prelude.scanl1 = List.scanl1;
|
89
|
+
prelude.scanr = List.scanr;
|
90
|
+
prelude.scanr1 = List.scanr1;
|
91
|
+
prelude.slice = List.slice;
|
92
|
+
prelude.take = List.take;
|
93
|
+
prelude.drop = List.drop;
|
94
|
+
prelude.splitAt = List.splitAt;
|
95
|
+
prelude.takeWhile = List.takeWhile;
|
96
|
+
prelude.dropWhile = List.dropWhile;
|
97
|
+
prelude.span = List.span;
|
98
|
+
prelude.breakList = List.breakList;
|
99
|
+
prelude.zip = List.zip;
|
100
|
+
prelude.zipWith = List.zipWith;
|
101
|
+
prelude.zipAll = List.zipAll;
|
102
|
+
prelude.zipAllWith = List.zipAllWith;
|
103
|
+
prelude.apply = Func.apply;
|
104
|
+
prelude.curry = Func.curry;
|
105
|
+
prelude.flip = Func.flip;
|
106
|
+
prelude.fix = Func.fix;
|
107
|
+
prelude.split = Str.split;
|
108
|
+
prelude.join = Str.join;
|
109
|
+
prelude.lines = Str.lines;
|
110
|
+
prelude.unlines = Str.unlines;
|
111
|
+
prelude.words = Str.words;
|
112
|
+
prelude.unwords = Str.unwords;
|
113
|
+
prelude.chars = Str.chars;
|
114
|
+
prelude.unchars = Str.unchars;
|
115
|
+
prelude.values = Obj.values;
|
116
|
+
prelude.keys = Obj.keys;
|
117
|
+
prelude.pairsToObj = Obj.pairsToObj;
|
118
|
+
prelude.objToPairs = Obj.objToPairs;
|
119
|
+
prelude.listsToObj = Obj.listsToObj;
|
120
|
+
prelude.objToLists = Obj.objToLists;
|
121
|
+
prelude.max = Num.max;
|
122
|
+
prelude.min = Num.min;
|
123
|
+
prelude.negate = Num.negate;
|
124
|
+
prelude.abs = Num.abs;
|
125
|
+
prelude.signum = Num.signum;
|
126
|
+
prelude.quot = Num.quot;
|
127
|
+
prelude.rem = Num.rem;
|
128
|
+
prelude.div = Num.div;
|
129
|
+
prelude.mod = Num.mod;
|
130
|
+
prelude.recip = Num.recip;
|
131
|
+
prelude.pi = Num.pi;
|
132
|
+
prelude.tau = Num.tau;
|
133
|
+
prelude.exp = Num.exp;
|
134
|
+
prelude.sqrt = Num.sqrt;
|
135
|
+
prelude.ln = Num.ln;
|
136
|
+
prelude.pow = Num.pow;
|
137
|
+
prelude.sin = Num.sin;
|
138
|
+
prelude.tan = Num.tan;
|
139
|
+
prelude.cos = Num.cos;
|
140
|
+
prelude.acos = Num.acos;
|
141
|
+
prelude.asin = Num.asin;
|
142
|
+
prelude.atan = Num.atan;
|
143
|
+
prelude.atan2 = Num.atan2;
|
144
|
+
prelude.truncate = Num.truncate;
|
145
|
+
prelude.round = Num.round;
|
146
|
+
prelude.ceiling = Num.ceiling;
|
147
|
+
prelude.floor = Num.floor;
|
148
|
+
prelude.isItNaN = Num.isItNaN;
|
149
|
+
prelude.even = Num.even;
|
150
|
+
prelude.odd = Num.odd;
|
151
|
+
prelude.gcd = Num.gcd;
|
152
|
+
prelude.lcm = Num.lcm;
|
153
|
+
prelude.VERSION = '1.0.3';
|
154
|
+
module.exports = prelude;
|
155
|
+
function curry$(f, bound){
|
156
|
+
var context,
|
157
|
+
_curry = function(args) {
|
158
|
+
return f.length > 1 ? function(){
|
159
|
+
var params = args ? args.concat() : [];
|
160
|
+
context = bound ? context || this : this;
|
161
|
+
return params.push.apply(params, arguments) <
|
162
|
+
f.length && arguments.length ?
|
163
|
+
_curry.call(context, params) : f.apply(context, params);
|
164
|
+
} : f;
|
165
|
+
};
|
166
|
+
return _curry();
|
167
|
+
}
|
168
|
+
|
169
|
+
},{"./Func.js":1,"./Obj.js":2,"./Num.js":3,"./List.js":4,"./Str.js":5}],1:[function(require,module,exports){
|
170
|
+
var curry, flip, fix, apply;
|
171
|
+
curry = function(f){
|
172
|
+
return curry$(f);
|
173
|
+
};
|
174
|
+
flip = curry$(function(f, x, y){
|
175
|
+
return f(y, x);
|
176
|
+
});
|
177
|
+
fix = function(f){
|
178
|
+
return function(g, x){
|
179
|
+
return function(){
|
180
|
+
return f(g(g)).apply(null, arguments);
|
181
|
+
};
|
182
|
+
}(function(g, x){
|
183
|
+
return function(){
|
184
|
+
return f(g(g)).apply(null, arguments);
|
185
|
+
};
|
186
|
+
});
|
187
|
+
};
|
188
|
+
apply = curry$(function(f, list){
|
189
|
+
return f.apply(null, list);
|
190
|
+
});
|
191
|
+
module.exports = {
|
192
|
+
curry: curry,
|
193
|
+
flip: flip,
|
194
|
+
fix: fix,
|
195
|
+
apply: apply
|
196
|
+
};
|
197
|
+
function curry$(f, bound){
|
198
|
+
var context,
|
199
|
+
_curry = function(args) {
|
200
|
+
return f.length > 1 ? function(){
|
201
|
+
var params = args ? args.concat() : [];
|
202
|
+
context = bound ? context || this : this;
|
203
|
+
return params.push.apply(params, arguments) <
|
204
|
+
f.length && arguments.length ?
|
205
|
+
_curry.call(context, params) : f.apply(context, params);
|
206
|
+
} : f;
|
207
|
+
};
|
208
|
+
return _curry();
|
209
|
+
}
|
210
|
+
|
211
|
+
},{}],2:[function(require,module,exports){
|
212
|
+
var values, keys, pairsToObj, objToPairs, listsToObj, objToLists, empty, each, map, compact, filter, reject, partition, find;
|
213
|
+
values = function(object){
|
214
|
+
var i$, x, results$ = [];
|
215
|
+
for (i$ in object) {
|
216
|
+
x = object[i$];
|
217
|
+
results$.push(x);
|
218
|
+
}
|
219
|
+
return results$;
|
220
|
+
};
|
221
|
+
keys = function(object){
|
222
|
+
var x, results$ = [];
|
223
|
+
for (x in object) {
|
224
|
+
results$.push(x);
|
225
|
+
}
|
226
|
+
return results$;
|
227
|
+
};
|
228
|
+
pairsToObj = function(object){
|
229
|
+
var i$, len$, x, results$ = {};
|
230
|
+
for (i$ = 0, len$ = object.length; i$ < len$; ++i$) {
|
231
|
+
x = object[i$];
|
232
|
+
results$[x[0]] = x[1];
|
233
|
+
}
|
234
|
+
return results$;
|
235
|
+
};
|
236
|
+
objToPairs = function(object){
|
237
|
+
var key, value, results$ = [];
|
238
|
+
for (key in object) {
|
239
|
+
value = object[key];
|
240
|
+
results$.push([key, value]);
|
241
|
+
}
|
242
|
+
return results$;
|
243
|
+
};
|
244
|
+
listsToObj = curry$(function(keys, values){
|
245
|
+
var i$, len$, i, key, results$ = {};
|
246
|
+
for (i$ = 0, len$ = keys.length; i$ < len$; ++i$) {
|
247
|
+
i = i$;
|
248
|
+
key = keys[i$];
|
249
|
+
results$[key] = values[i];
|
250
|
+
}
|
251
|
+
return results$;
|
252
|
+
});
|
253
|
+
objToLists = function(objectect){
|
254
|
+
var keys, values, key, value;
|
255
|
+
keys = [];
|
256
|
+
values = [];
|
257
|
+
for (key in objectect) {
|
258
|
+
value = objectect[key];
|
259
|
+
keys.push(key);
|
260
|
+
values.push(value);
|
261
|
+
}
|
262
|
+
return [keys, values];
|
263
|
+
};
|
264
|
+
empty = function(object){
|
265
|
+
var x;
|
266
|
+
for (x in object) {
|
267
|
+
return false;
|
268
|
+
}
|
269
|
+
return true;
|
270
|
+
};
|
271
|
+
each = curry$(function(f, object){
|
272
|
+
var i$, x;
|
273
|
+
for (i$ in object) {
|
274
|
+
x = object[i$];
|
275
|
+
f(x);
|
276
|
+
}
|
277
|
+
return object;
|
278
|
+
});
|
279
|
+
map = curry$(function(f, object){
|
280
|
+
var k, x, results$ = {};
|
281
|
+
for (k in object) {
|
282
|
+
x = object[k];
|
283
|
+
results$[k] = f(x);
|
284
|
+
}
|
285
|
+
return results$;
|
286
|
+
});
|
287
|
+
compact = curry$(function(object){
|
288
|
+
var k, x, results$ = {};
|
289
|
+
for (k in object) {
|
290
|
+
x = object[k];
|
291
|
+
if (x) {
|
292
|
+
results$[k] = x;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
return results$;
|
296
|
+
});
|
297
|
+
filter = curry$(function(f, object){
|
298
|
+
var k, x, results$ = {};
|
299
|
+
for (k in object) {
|
300
|
+
x = object[k];
|
301
|
+
if (f(x)) {
|
302
|
+
results$[k] = x;
|
303
|
+
}
|
304
|
+
}
|
305
|
+
return results$;
|
306
|
+
});
|
307
|
+
reject = curry$(function(f, object){
|
308
|
+
var k, x, results$ = {};
|
309
|
+
for (k in object) {
|
310
|
+
x = object[k];
|
311
|
+
if (!f(x)) {
|
312
|
+
results$[k] = x;
|
313
|
+
}
|
314
|
+
}
|
315
|
+
return results$;
|
316
|
+
});
|
317
|
+
partition = curry$(function(f, object){
|
318
|
+
var passed, failed, k, x;
|
319
|
+
passed = {};
|
320
|
+
failed = {};
|
321
|
+
for (k in object) {
|
322
|
+
x = object[k];
|
323
|
+
(f(x) ? passed : failed)[k] = x;
|
324
|
+
}
|
325
|
+
return [passed, failed];
|
326
|
+
});
|
327
|
+
find = curry$(function(f, object){
|
328
|
+
var i$, x;
|
329
|
+
for (i$ in object) {
|
330
|
+
x = object[i$];
|
331
|
+
if (f(x)) {
|
332
|
+
return x;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
});
|
336
|
+
module.exports = {
|
337
|
+
values: values,
|
338
|
+
keys: keys,
|
339
|
+
pairsToObj: pairsToObj,
|
340
|
+
objToPairs: objToPairs,
|
341
|
+
listsToObj: listsToObj,
|
342
|
+
objToLists: objToLists,
|
343
|
+
empty: empty,
|
344
|
+
each: each,
|
345
|
+
map: map,
|
346
|
+
filter: filter,
|
347
|
+
compact: compact,
|
348
|
+
reject: reject,
|
349
|
+
partition: partition,
|
350
|
+
find: find
|
351
|
+
};
|
352
|
+
function curry$(f, bound){
|
353
|
+
var context,
|
354
|
+
_curry = function(args) {
|
355
|
+
return f.length > 1 ? function(){
|
356
|
+
var params = args ? args.concat() : [];
|
357
|
+
context = bound ? context || this : this;
|
358
|
+
return params.push.apply(params, arguments) <
|
359
|
+
f.length && arguments.length ?
|
360
|
+
_curry.call(context, params) : f.apply(context, params);
|
361
|
+
} : f;
|
362
|
+
};
|
363
|
+
return _curry();
|
364
|
+
}
|
365
|
+
|
366
|
+
},{}],3:[function(require,module,exports){
|
367
|
+
var max, min, negate, abs, signum, quot, rem, div, mod, recip, pi, tau, exp, sqrt, ln, pow, sin, tan, cos, asin, acos, atan, atan2, truncate, round, ceiling, floor, isItNaN, even, odd, gcd, lcm;
|
368
|
+
max = curry$(function(x$, y$){
|
369
|
+
return x$ > y$ ? x$ : y$;
|
370
|
+
});
|
371
|
+
min = curry$(function(x$, y$){
|
372
|
+
return x$ < y$ ? x$ : y$;
|
373
|
+
});
|
374
|
+
negate = function(x){
|
375
|
+
return -x;
|
376
|
+
};
|
377
|
+
abs = Math.abs;
|
378
|
+
signum = function(x){
|
379
|
+
if (x < 0) {
|
380
|
+
return -1;
|
381
|
+
} else if (x > 0) {
|
382
|
+
return 1;
|
383
|
+
} else {
|
384
|
+
return 0;
|
385
|
+
}
|
386
|
+
};
|
387
|
+
quot = curry$(function(x, y){
|
388
|
+
return ~~(x / y);
|
389
|
+
});
|
390
|
+
rem = curry$(function(x$, y$){
|
391
|
+
return x$ % y$;
|
392
|
+
});
|
393
|
+
div = curry$(function(x, y){
|
394
|
+
return Math.floor(x / y);
|
395
|
+
});
|
396
|
+
mod = curry$(function(x$, y$){
|
397
|
+
var ref$;
|
398
|
+
return ((x$) % (ref$ = y$) + ref$) % ref$;
|
399
|
+
});
|
400
|
+
recip = (function(it){
|
401
|
+
return 1 / it;
|
402
|
+
});
|
403
|
+
pi = Math.PI;
|
404
|
+
tau = pi * 2;
|
405
|
+
exp = Math.exp;
|
406
|
+
sqrt = Math.sqrt;
|
407
|
+
ln = Math.log;
|
408
|
+
pow = curry$(function(x$, y$){
|
409
|
+
return Math.pow(x$, y$);
|
410
|
+
});
|
411
|
+
sin = Math.sin;
|
412
|
+
tan = Math.tan;
|
413
|
+
cos = Math.cos;
|
414
|
+
asin = Math.asin;
|
415
|
+
acos = Math.acos;
|
416
|
+
atan = Math.atan;
|
417
|
+
atan2 = curry$(function(x, y){
|
418
|
+
return Math.atan2(x, y);
|
419
|
+
});
|
420
|
+
truncate = function(x){
|
421
|
+
return ~~x;
|
422
|
+
};
|
423
|
+
round = Math.round;
|
424
|
+
ceiling = Math.ceil;
|
425
|
+
floor = Math.floor;
|
426
|
+
isItNaN = function(x){
|
427
|
+
return x !== x;
|
428
|
+
};
|
429
|
+
even = function(x){
|
430
|
+
return x % 2 === 0;
|
431
|
+
};
|
432
|
+
odd = function(x){
|
433
|
+
return x % 2 !== 0;
|
434
|
+
};
|
435
|
+
gcd = curry$(function(x, y){
|
436
|
+
var z;
|
437
|
+
x = Math.abs(x);
|
438
|
+
y = Math.abs(y);
|
439
|
+
while (y !== 0) {
|
440
|
+
z = x % y;
|
441
|
+
x = y;
|
442
|
+
y = z;
|
443
|
+
}
|
444
|
+
return x;
|
445
|
+
});
|
446
|
+
lcm = curry$(function(x, y){
|
447
|
+
return Math.abs(Math.floor(x / gcd(x, y) * y));
|
448
|
+
});
|
449
|
+
module.exports = {
|
450
|
+
max: max,
|
451
|
+
min: min,
|
452
|
+
negate: negate,
|
453
|
+
abs: abs,
|
454
|
+
signum: signum,
|
455
|
+
quot: quot,
|
456
|
+
rem: rem,
|
457
|
+
div: div,
|
458
|
+
mod: mod,
|
459
|
+
recip: recip,
|
460
|
+
pi: pi,
|
461
|
+
tau: tau,
|
462
|
+
exp: exp,
|
463
|
+
sqrt: sqrt,
|
464
|
+
ln: ln,
|
465
|
+
pow: pow,
|
466
|
+
sin: sin,
|
467
|
+
tan: tan,
|
468
|
+
cos: cos,
|
469
|
+
acos: acos,
|
470
|
+
asin: asin,
|
471
|
+
atan: atan,
|
472
|
+
atan2: atan2,
|
473
|
+
truncate: truncate,
|
474
|
+
round: round,
|
475
|
+
ceiling: ceiling,
|
476
|
+
floor: floor,
|
477
|
+
isItNaN: isItNaN,
|
478
|
+
even: even,
|
479
|
+
odd: odd,
|
480
|
+
gcd: gcd,
|
481
|
+
lcm: lcm
|
482
|
+
};
|
483
|
+
function curry$(f, bound){
|
484
|
+
var context,
|
485
|
+
_curry = function(args) {
|
486
|
+
return f.length > 1 ? function(){
|
487
|
+
var params = args ? args.concat() : [];
|
488
|
+
context = bound ? context || this : this;
|
489
|
+
return params.push.apply(params, arguments) <
|
490
|
+
f.length && arguments.length ?
|
491
|
+
_curry.call(context, params) : f.apply(context, params);
|
492
|
+
} : f;
|
493
|
+
};
|
494
|
+
return _curry();
|
495
|
+
}
|
496
|
+
|
497
|
+
},{}],4:[function(require,module,exports){
|
498
|
+
var each, map, compact, filter, reject, partition, find, head, first, tail, last, initial, empty, reverse, unique, fold, foldl, fold1, foldl1, foldr, foldr1, unfoldr, concat, concatMap, flatten, difference, intersection, union, countBy, groupBy, andList, orList, any, all, sort, sortWith, sortBy, sum, product, mean, average, maximum, minimum, scan, scanl, scan1, scanl1, scanr, scanr1, slice, take, drop, splitAt, takeWhile, dropWhile, span, breakList, zip, zipWith, zipAll, zipAllWith, toString$ = {}.toString, slice$ = [].slice;
|
499
|
+
each = curry$(function(f, xs){
|
500
|
+
var i$, len$, x;
|
501
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
502
|
+
x = xs[i$];
|
503
|
+
f(x);
|
504
|
+
}
|
505
|
+
return xs;
|
506
|
+
});
|
507
|
+
map = curry$(function(f, xs){
|
508
|
+
var i$, len$, x, results$ = [];
|
509
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
510
|
+
x = xs[i$];
|
511
|
+
results$.push(f(x));
|
512
|
+
}
|
513
|
+
return results$;
|
514
|
+
});
|
515
|
+
compact = curry$(function(xs){
|
516
|
+
var i$, len$, x, results$ = [];
|
517
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
518
|
+
x = xs[i$];
|
519
|
+
if (x) {
|
520
|
+
results$.push(x);
|
521
|
+
}
|
522
|
+
}
|
523
|
+
return results$;
|
524
|
+
});
|
525
|
+
filter = curry$(function(f, xs){
|
526
|
+
var i$, len$, x, results$ = [];
|
527
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
528
|
+
x = xs[i$];
|
529
|
+
if (f(x)) {
|
530
|
+
results$.push(x);
|
531
|
+
}
|
532
|
+
}
|
533
|
+
return results$;
|
534
|
+
});
|
535
|
+
reject = curry$(function(f, xs){
|
536
|
+
var i$, len$, x, results$ = [];
|
537
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
538
|
+
x = xs[i$];
|
539
|
+
if (!f(x)) {
|
540
|
+
results$.push(x);
|
541
|
+
}
|
542
|
+
}
|
543
|
+
return results$;
|
544
|
+
});
|
545
|
+
partition = curry$(function(f, xs){
|
546
|
+
var passed, failed, i$, len$, x;
|
547
|
+
passed = [];
|
548
|
+
failed = [];
|
549
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
550
|
+
x = xs[i$];
|
551
|
+
(f(x) ? passed : failed).push(x);
|
552
|
+
}
|
553
|
+
return [passed, failed];
|
554
|
+
});
|
555
|
+
find = curry$(function(f, xs){
|
556
|
+
var i$, len$, x;
|
557
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
558
|
+
x = xs[i$];
|
559
|
+
if (f(x)) {
|
560
|
+
return x;
|
561
|
+
}
|
562
|
+
}
|
563
|
+
});
|
564
|
+
head = first = function(xs){
|
565
|
+
if (!xs.length) {
|
566
|
+
return;
|
567
|
+
}
|
568
|
+
return xs[0];
|
569
|
+
};
|
570
|
+
tail = function(xs){
|
571
|
+
if (!xs.length) {
|
572
|
+
return;
|
573
|
+
}
|
574
|
+
return xs.slice(1);
|
575
|
+
};
|
576
|
+
last = function(xs){
|
577
|
+
if (!xs.length) {
|
578
|
+
return;
|
579
|
+
}
|
580
|
+
return xs[xs.length - 1];
|
581
|
+
};
|
582
|
+
initial = function(xs){
|
583
|
+
var len;
|
584
|
+
len = xs.length;
|
585
|
+
if (!len) {
|
586
|
+
return;
|
587
|
+
}
|
588
|
+
return xs.slice(0, len - 1);
|
589
|
+
};
|
590
|
+
empty = function(xs){
|
591
|
+
return !xs.length;
|
592
|
+
};
|
593
|
+
reverse = function(xs){
|
594
|
+
return xs.concat().reverse();
|
595
|
+
};
|
596
|
+
unique = function(xs){
|
597
|
+
var result, i$, len$, x;
|
598
|
+
result = [];
|
599
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
600
|
+
x = xs[i$];
|
601
|
+
if (!in$(x, result)) {
|
602
|
+
result.push(x);
|
603
|
+
}
|
604
|
+
}
|
605
|
+
return result;
|
606
|
+
};
|
607
|
+
fold = foldl = curry$(function(f, memo, xs){
|
608
|
+
var i$, len$, x;
|
609
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
610
|
+
x = xs[i$];
|
611
|
+
memo = f(memo, x);
|
612
|
+
}
|
613
|
+
return memo;
|
614
|
+
});
|
615
|
+
fold1 = foldl1 = curry$(function(f, xs){
|
616
|
+
return fold(f, xs[0], xs.slice(1));
|
617
|
+
});
|
618
|
+
foldr = curry$(function(f, memo, xs){
|
619
|
+
return fold(f, memo, xs.concat().reverse());
|
620
|
+
});
|
621
|
+
foldr1 = curry$(function(f, xs){
|
622
|
+
var ys;
|
623
|
+
ys = xs.concat().reverse();
|
624
|
+
return fold(f, ys[0], ys.slice(1));
|
625
|
+
});
|
626
|
+
unfoldr = curry$(function(f, b){
|
627
|
+
var result, x, that;
|
628
|
+
result = [];
|
629
|
+
x = b;
|
630
|
+
while ((that = f(x)) != null) {
|
631
|
+
result.push(that[0]);
|
632
|
+
x = that[1];
|
633
|
+
}
|
634
|
+
return result;
|
635
|
+
});
|
636
|
+
concat = function(xss){
|
637
|
+
return [].concat.apply([], xss);
|
638
|
+
};
|
639
|
+
concatMap = curry$(function(f, xs){
|
640
|
+
var x;
|
641
|
+
return [].concat.apply([], (function(){
|
642
|
+
var i$, ref$, len$, results$ = [];
|
643
|
+
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
644
|
+
x = ref$[i$];
|
645
|
+
results$.push(f(x));
|
646
|
+
}
|
647
|
+
return results$;
|
648
|
+
}()));
|
649
|
+
});
|
650
|
+
flatten = curry$(function(xs){
|
651
|
+
var x;
|
652
|
+
return [].concat.apply([], (function(){
|
653
|
+
var i$, ref$, len$, results$ = [];
|
654
|
+
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
655
|
+
x = ref$[i$];
|
656
|
+
if (toString$.call(x).slice(8, -1) === 'Array') {
|
657
|
+
results$.push(flatten(x));
|
658
|
+
} else {
|
659
|
+
results$.push(x);
|
660
|
+
}
|
661
|
+
}
|
662
|
+
return results$;
|
663
|
+
}()));
|
664
|
+
});
|
665
|
+
difference = function(xs){
|
666
|
+
var yss, results, i$, len$, x, j$, len1$, ys;
|
667
|
+
yss = slice$.call(arguments, 1);
|
668
|
+
results = [];
|
669
|
+
outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
670
|
+
x = xs[i$];
|
671
|
+
for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
|
672
|
+
ys = yss[j$];
|
673
|
+
if (in$(x, ys)) {
|
674
|
+
continue outer;
|
675
|
+
}
|
676
|
+
}
|
677
|
+
results.push(x);
|
678
|
+
}
|
679
|
+
return results;
|
680
|
+
};
|
681
|
+
intersection = function(xs){
|
682
|
+
var yss, results, i$, len$, x, j$, len1$, ys;
|
683
|
+
yss = slice$.call(arguments, 1);
|
684
|
+
results = [];
|
685
|
+
outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
686
|
+
x = xs[i$];
|
687
|
+
for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
|
688
|
+
ys = yss[j$];
|
689
|
+
if (!in$(x, ys)) {
|
690
|
+
continue outer;
|
691
|
+
}
|
692
|
+
}
|
693
|
+
results.push(x);
|
694
|
+
}
|
695
|
+
return results;
|
696
|
+
};
|
697
|
+
union = function(){
|
698
|
+
var xss, results, i$, len$, xs, j$, len1$, x;
|
699
|
+
xss = slice$.call(arguments);
|
700
|
+
results = [];
|
701
|
+
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
702
|
+
xs = xss[i$];
|
703
|
+
for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) {
|
704
|
+
x = xs[j$];
|
705
|
+
if (!in$(x, results)) {
|
706
|
+
results.push(x);
|
707
|
+
}
|
708
|
+
}
|
709
|
+
}
|
710
|
+
return results;
|
711
|
+
};
|
712
|
+
countBy = curry$(function(f, xs){
|
713
|
+
var results, i$, len$, x, key;
|
714
|
+
results = {};
|
715
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
716
|
+
x = xs[i$];
|
717
|
+
key = f(x);
|
718
|
+
if (key in results) {
|
719
|
+
results[key] += 1;
|
720
|
+
} else {
|
721
|
+
results[key] = 1;
|
722
|
+
}
|
723
|
+
}
|
724
|
+
return results;
|
725
|
+
});
|
726
|
+
groupBy = curry$(function(f, xs){
|
727
|
+
var results, i$, len$, x, key;
|
728
|
+
results = {};
|
729
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
730
|
+
x = xs[i$];
|
731
|
+
key = f(x);
|
732
|
+
if (key in results) {
|
733
|
+
results[key].push(x);
|
734
|
+
} else {
|
735
|
+
results[key] = [x];
|
736
|
+
}
|
737
|
+
}
|
738
|
+
return results;
|
739
|
+
});
|
740
|
+
andList = function(xs){
|
741
|
+
var i$, len$, x;
|
742
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
743
|
+
x = xs[i$];
|
744
|
+
if (!x) {
|
745
|
+
return false;
|
746
|
+
}
|
747
|
+
}
|
748
|
+
return true;
|
749
|
+
};
|
750
|
+
orList = function(xs){
|
751
|
+
var i$, len$, x;
|
752
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
753
|
+
x = xs[i$];
|
754
|
+
if (x) {
|
755
|
+
return true;
|
756
|
+
}
|
757
|
+
}
|
758
|
+
return false;
|
759
|
+
};
|
760
|
+
any = curry$(function(f, xs){
|
761
|
+
var i$, len$, x;
|
762
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
763
|
+
x = xs[i$];
|
764
|
+
if (f(x)) {
|
765
|
+
return true;
|
766
|
+
}
|
767
|
+
}
|
768
|
+
return false;
|
769
|
+
});
|
770
|
+
all = curry$(function(f, xs){
|
771
|
+
var i$, len$, x;
|
772
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
773
|
+
x = xs[i$];
|
774
|
+
if (!f(x)) {
|
775
|
+
return false;
|
776
|
+
}
|
777
|
+
}
|
778
|
+
return true;
|
779
|
+
});
|
780
|
+
sort = function(xs){
|
781
|
+
return xs.concat().sort(function(x, y){
|
782
|
+
if (x > y) {
|
783
|
+
return 1;
|
784
|
+
} else if (x < y) {
|
785
|
+
return -1;
|
786
|
+
} else {
|
787
|
+
return 0;
|
788
|
+
}
|
789
|
+
});
|
790
|
+
};
|
791
|
+
sortWith = curry$(function(f, xs){
|
792
|
+
if (!xs.length) {
|
793
|
+
return [];
|
794
|
+
}
|
795
|
+
return xs.concat().sort(f);
|
796
|
+
});
|
797
|
+
sortBy = curry$(function(f, xs){
|
798
|
+
if (!xs.length) {
|
799
|
+
return [];
|
800
|
+
}
|
801
|
+
return xs.concat().sort(function(x, y){
|
802
|
+
if (f(x) > f(y)) {
|
803
|
+
return 1;
|
804
|
+
} else if (f(x) < f(y)) {
|
805
|
+
return -1;
|
806
|
+
} else {
|
807
|
+
return 0;
|
808
|
+
}
|
809
|
+
});
|
810
|
+
});
|
811
|
+
sum = function(xs){
|
812
|
+
var result, i$, len$, x;
|
813
|
+
result = 0;
|
814
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
815
|
+
x = xs[i$];
|
816
|
+
result += x;
|
817
|
+
}
|
818
|
+
return result;
|
819
|
+
};
|
820
|
+
product = function(xs){
|
821
|
+
var result, i$, len$, x;
|
822
|
+
result = 1;
|
823
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
824
|
+
x = xs[i$];
|
825
|
+
result *= x;
|
826
|
+
}
|
827
|
+
return result;
|
828
|
+
};
|
829
|
+
mean = average = function(xs){
|
830
|
+
var sum, len, i$, i;
|
831
|
+
sum = 0;
|
832
|
+
len = xs.length;
|
833
|
+
for (i$ = 0; i$ < len; ++i$) {
|
834
|
+
i = i$;
|
835
|
+
sum += xs[i];
|
836
|
+
}
|
837
|
+
return sum / len;
|
838
|
+
};
|
839
|
+
maximum = function(xs){
|
840
|
+
var max, i$, ref$, len$, x;
|
841
|
+
max = xs[0];
|
842
|
+
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
843
|
+
x = ref$[i$];
|
844
|
+
if (x > max) {
|
845
|
+
max = x;
|
846
|
+
}
|
847
|
+
}
|
848
|
+
return max;
|
849
|
+
};
|
850
|
+
minimum = function(xs){
|
851
|
+
var min, i$, ref$, len$, x;
|
852
|
+
min = xs[0];
|
853
|
+
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
854
|
+
x = ref$[i$];
|
855
|
+
if (x < min) {
|
856
|
+
min = x;
|
857
|
+
}
|
858
|
+
}
|
859
|
+
return min;
|
860
|
+
};
|
861
|
+
scan = scanl = curry$(function(f, memo, xs){
|
862
|
+
var last, x;
|
863
|
+
last = memo;
|
864
|
+
return [memo].concat((function(){
|
865
|
+
var i$, ref$, len$, results$ = [];
|
866
|
+
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
867
|
+
x = ref$[i$];
|
868
|
+
results$.push(last = f(last, x));
|
869
|
+
}
|
870
|
+
return results$;
|
871
|
+
}()));
|
872
|
+
});
|
873
|
+
scan1 = scanl1 = curry$(function(f, xs){
|
874
|
+
if (!xs.length) {
|
875
|
+
return;
|
876
|
+
}
|
877
|
+
return scan(f, xs[0], xs.slice(1));
|
878
|
+
});
|
879
|
+
scanr = curry$(function(f, memo, xs){
|
880
|
+
xs = xs.concat().reverse();
|
881
|
+
return scan(f, memo, xs).reverse();
|
882
|
+
});
|
883
|
+
scanr1 = curry$(function(f, xs){
|
884
|
+
if (!xs.length) {
|
885
|
+
return;
|
886
|
+
}
|
887
|
+
xs = xs.concat().reverse();
|
888
|
+
return scan(f, xs[0], xs.slice(1)).reverse();
|
889
|
+
});
|
890
|
+
slice = curry$(function(x, y, xs){
|
891
|
+
return xs.slice(x, y);
|
892
|
+
});
|
893
|
+
take = curry$(function(n, xs){
|
894
|
+
if (n <= 0) {
|
895
|
+
return xs.slice(0, 0);
|
896
|
+
} else if (!xs.length) {
|
897
|
+
return xs;
|
898
|
+
} else {
|
899
|
+
return xs.slice(0, n);
|
900
|
+
}
|
901
|
+
});
|
902
|
+
drop = curry$(function(n, xs){
|
903
|
+
if (n <= 0 || !xs.length) {
|
904
|
+
return xs;
|
905
|
+
} else {
|
906
|
+
return xs.slice(n);
|
907
|
+
}
|
908
|
+
});
|
909
|
+
splitAt = curry$(function(n, xs){
|
910
|
+
return [take(n, xs), drop(n, xs)];
|
911
|
+
});
|
912
|
+
takeWhile = curry$(function(p, xs){
|
913
|
+
var len, i;
|
914
|
+
len = xs.length;
|
915
|
+
if (!len) {
|
916
|
+
return xs;
|
917
|
+
}
|
918
|
+
i = 0;
|
919
|
+
while (i < len && p(xs[i])) {
|
920
|
+
i += 1;
|
921
|
+
}
|
922
|
+
return xs.slice(0, i);
|
923
|
+
});
|
924
|
+
dropWhile = curry$(function(p, xs){
|
925
|
+
var len, i;
|
926
|
+
len = xs.length;
|
927
|
+
if (!len) {
|
928
|
+
return xs;
|
929
|
+
}
|
930
|
+
i = 0;
|
931
|
+
while (i < len && p(xs[i])) {
|
932
|
+
i += 1;
|
933
|
+
}
|
934
|
+
return xs.slice(i);
|
935
|
+
});
|
936
|
+
span = curry$(function(p, xs){
|
937
|
+
return [takeWhile(p, xs), dropWhile(p, xs)];
|
938
|
+
});
|
939
|
+
breakList = curry$(function(p, xs){
|
940
|
+
return span(compose$([not$, p]), xs);
|
941
|
+
});
|
942
|
+
zip = curry$(function(xs, ys){
|
943
|
+
var result, len, i$, len$, i, x;
|
944
|
+
result = [];
|
945
|
+
len = ys.length;
|
946
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
947
|
+
i = i$;
|
948
|
+
x = xs[i$];
|
949
|
+
if (i === len) {
|
950
|
+
break;
|
951
|
+
}
|
952
|
+
result.push([x, ys[i]]);
|
953
|
+
}
|
954
|
+
return result;
|
955
|
+
});
|
956
|
+
zipWith = curry$(function(f, xs, ys){
|
957
|
+
var result, len, i$, len$, i, x;
|
958
|
+
result = [];
|
959
|
+
len = ys.length;
|
960
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
961
|
+
i = i$;
|
962
|
+
x = xs[i$];
|
963
|
+
if (i === len) {
|
964
|
+
break;
|
965
|
+
}
|
966
|
+
result.push(f(x, ys[i]));
|
967
|
+
}
|
968
|
+
return result;
|
969
|
+
});
|
970
|
+
zipAll = function(){
|
971
|
+
var xss, minLength, i$, len$, xs, ref$, i, lresult$, j$, results$ = [];
|
972
|
+
xss = slice$.call(arguments);
|
973
|
+
minLength = 9e9;
|
974
|
+
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
975
|
+
xs = xss[i$];
|
976
|
+
minLength <= (ref$ = xs.length) || (minLength = ref$);
|
977
|
+
}
|
978
|
+
for (i$ = 0; i$ < minLength; ++i$) {
|
979
|
+
i = i$;
|
980
|
+
lresult$ = [];
|
981
|
+
for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) {
|
982
|
+
xs = xss[j$];
|
983
|
+
lresult$.push(xs[i]);
|
984
|
+
}
|
985
|
+
results$.push(lresult$);
|
986
|
+
}
|
987
|
+
return results$;
|
988
|
+
};
|
989
|
+
zipAllWith = function(f){
|
990
|
+
var xss, minLength, i$, len$, xs, ref$, i, results$ = [];
|
991
|
+
xss = slice$.call(arguments, 1);
|
992
|
+
minLength = 9e9;
|
993
|
+
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
994
|
+
xs = xss[i$];
|
995
|
+
minLength <= (ref$ = xs.length) || (minLength = ref$);
|
996
|
+
}
|
997
|
+
for (i$ = 0; i$ < minLength; ++i$) {
|
998
|
+
i = i$;
|
999
|
+
results$.push(f.apply(null, (fn$())));
|
1000
|
+
}
|
1001
|
+
return results$;
|
1002
|
+
function fn$(){
|
1003
|
+
var i$, ref$, len$, results$ = [];
|
1004
|
+
for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) {
|
1005
|
+
xs = ref$[i$];
|
1006
|
+
results$.push(xs[i]);
|
1007
|
+
}
|
1008
|
+
return results$;
|
1009
|
+
}
|
1010
|
+
};
|
1011
|
+
module.exports = {
|
1012
|
+
each: each,
|
1013
|
+
map: map,
|
1014
|
+
filter: filter,
|
1015
|
+
compact: compact,
|
1016
|
+
reject: reject,
|
1017
|
+
partition: partition,
|
1018
|
+
find: find,
|
1019
|
+
head: head,
|
1020
|
+
first: first,
|
1021
|
+
tail: tail,
|
1022
|
+
last: last,
|
1023
|
+
initial: initial,
|
1024
|
+
empty: empty,
|
1025
|
+
reverse: reverse,
|
1026
|
+
difference: difference,
|
1027
|
+
intersection: intersection,
|
1028
|
+
union: union,
|
1029
|
+
countBy: countBy,
|
1030
|
+
groupBy: groupBy,
|
1031
|
+
fold: fold,
|
1032
|
+
fold1: fold1,
|
1033
|
+
foldl: foldl,
|
1034
|
+
foldl1: foldl1,
|
1035
|
+
foldr: foldr,
|
1036
|
+
foldr1: foldr1,
|
1037
|
+
unfoldr: unfoldr,
|
1038
|
+
andList: andList,
|
1039
|
+
orList: orList,
|
1040
|
+
any: any,
|
1041
|
+
all: all,
|
1042
|
+
unique: unique,
|
1043
|
+
sort: sort,
|
1044
|
+
sortWith: sortWith,
|
1045
|
+
sortBy: sortBy,
|
1046
|
+
sum: sum,
|
1047
|
+
product: product,
|
1048
|
+
mean: mean,
|
1049
|
+
average: average,
|
1050
|
+
concat: concat,
|
1051
|
+
concatMap: concatMap,
|
1052
|
+
flatten: flatten,
|
1053
|
+
maximum: maximum,
|
1054
|
+
minimum: minimum,
|
1055
|
+
scan: scan,
|
1056
|
+
scan1: scan1,
|
1057
|
+
scanl: scanl,
|
1058
|
+
scanl1: scanl1,
|
1059
|
+
scanr: scanr,
|
1060
|
+
scanr1: scanr1,
|
1061
|
+
slice: slice,
|
1062
|
+
take: take,
|
1063
|
+
drop: drop,
|
1064
|
+
splitAt: splitAt,
|
1065
|
+
takeWhile: takeWhile,
|
1066
|
+
dropWhile: dropWhile,
|
1067
|
+
span: span,
|
1068
|
+
breakList: breakList,
|
1069
|
+
zip: zip,
|
1070
|
+
zipWith: zipWith,
|
1071
|
+
zipAll: zipAll,
|
1072
|
+
zipAllWith: zipAllWith
|
1073
|
+
};
|
1074
|
+
function curry$(f, bound){
|
1075
|
+
var context,
|
1076
|
+
_curry = function(args) {
|
1077
|
+
return f.length > 1 ? function(){
|
1078
|
+
var params = args ? args.concat() : [];
|
1079
|
+
context = bound ? context || this : this;
|
1080
|
+
return params.push.apply(params, arguments) <
|
1081
|
+
f.length && arguments.length ?
|
1082
|
+
_curry.call(context, params) : f.apply(context, params);
|
1083
|
+
} : f;
|
1084
|
+
};
|
1085
|
+
return _curry();
|
1086
|
+
}
|
1087
|
+
function in$(x, arr){
|
1088
|
+
var i = -1, l = arr.length >>> 0;
|
1089
|
+
while (++i < l) if (x === arr[i] && i in arr) return true;
|
1090
|
+
return false;
|
1091
|
+
}
|
1092
|
+
function compose$(fs){
|
1093
|
+
return function(){
|
1094
|
+
var i, args = arguments;
|
1095
|
+
for (i = fs.length; i > 0; --i) { args = [fs[i-1].apply(this, args)]; }
|
1096
|
+
return args[0];
|
1097
|
+
};
|
1098
|
+
}
|
1099
|
+
function not$(x){ return !x; }
|
1100
|
+
|
1101
|
+
},{}],5:[function(require,module,exports){
|
1102
|
+
var split, join, lines, unlines, words, unwords, chars, unchars, reverse, repeat;
|
1103
|
+
split = curry$(function(sep, str){
|
1104
|
+
return str.split(sep);
|
1105
|
+
});
|
1106
|
+
join = curry$(function(sep, xs){
|
1107
|
+
return xs.join(sep);
|
1108
|
+
});
|
1109
|
+
lines = function(str){
|
1110
|
+
if (!str.length) {
|
1111
|
+
return [];
|
1112
|
+
}
|
1113
|
+
return str.split('\n');
|
1114
|
+
};
|
1115
|
+
unlines = function(it){
|
1116
|
+
return it.join('\n');
|
1117
|
+
};
|
1118
|
+
words = function(str){
|
1119
|
+
if (!str.length) {
|
1120
|
+
return [];
|
1121
|
+
}
|
1122
|
+
return str.split(/[ ]+/);
|
1123
|
+
};
|
1124
|
+
unwords = function(it){
|
1125
|
+
return it.join(' ');
|
1126
|
+
};
|
1127
|
+
chars = function(it){
|
1128
|
+
return it.split('');
|
1129
|
+
};
|
1130
|
+
unchars = function(it){
|
1131
|
+
return it.join('');
|
1132
|
+
};
|
1133
|
+
reverse = function(str){
|
1134
|
+
return str.split('').reverse().join('');
|
1135
|
+
};
|
1136
|
+
repeat = curry$(function(n, str){
|
1137
|
+
var out, res$, i$;
|
1138
|
+
res$ = [];
|
1139
|
+
for (i$ = 0; i$ < n; ++i$) {
|
1140
|
+
res$.push(str);
|
1141
|
+
}
|
1142
|
+
out = res$;
|
1143
|
+
return out.join('');
|
1144
|
+
});
|
1145
|
+
module.exports = {
|
1146
|
+
split: split,
|
1147
|
+
join: join,
|
1148
|
+
lines: lines,
|
1149
|
+
unlines: unlines,
|
1150
|
+
words: words,
|
1151
|
+
unwords: unwords,
|
1152
|
+
chars: chars,
|
1153
|
+
unchars: unchars,
|
1154
|
+
reverse: reverse,
|
1155
|
+
repeat: repeat
|
1156
|
+
};
|
1157
|
+
function curry$(f, bound){
|
1158
|
+
var context,
|
1159
|
+
_curry = function(args) {
|
1160
|
+
return f.length > 1 ? function(){
|
1161
|
+
var params = args ? args.concat() : [];
|
1162
|
+
context = bound ? context || this : this;
|
1163
|
+
return params.push.apply(params, arguments) <
|
1164
|
+
f.length && arguments.length ?
|
1165
|
+
_curry.call(context, params) : f.apply(context, params);
|
1166
|
+
} : f;
|
1167
|
+
};
|
1168
|
+
return _curry();
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
},{}]},{},[])
|
1172
|
+
;
|