diff --git a/id.js b/id.js index 48341e9..689a5cc 100644 --- a/id.js +++ b/id.js @@ -1,81 +1,83 @@ -var fl = require('./') +'use strict'; -function Id(a) { - this.value = a; -} +const fl = require('./'); + +const Id = function Id(a) { + this.value = a; +}; // Setoid Id.prototype[fl.equals] = function(b) { - return typeof this.value[fl.equals] === "function" ? this.value[fl.equals](b.value) : this.value === b.value; + return typeof this.value[fl.equals] === 'function' ? this.value[fl.equals](b.value) : this.value === b.value; }; // Semigroup (value must also be a Semigroup) Id.prototype[fl.concat] = function(b) { - return new Id(this.value[fl.concat](b.value)); + return new Id(this.value[fl.concat](b.value)); }; // Monoid (value must also be a Monoid) Id[fl.empty] = function() { - return new Id(this.value[fl.empty] ? this.value[fl.empty]() : this.value.constructor[fl.empty]()); + return new Id(this.value[fl.empty] ? this.value[fl.empty]() : this.value.constructor[fl.empty]()); }; Id.prototype[fl.empty] = Id[fl.empty]; // Foldable Id.prototype[fl.reduce] = function(f, acc) { - return f(acc, this.value); + return f(acc, this.value); }; Id.prototype.toArray = function() { - return [this.value]; + return [this.value]; }; // Functor Id.prototype[fl.map] = function(f) { - return new Id(f(this.value)); + return new Id(f(this.value)); }; // Apply Id.prototype[fl.ap] = function(b) { - return new Id(b.value(this.value)); + return new Id(b.value(this.value)); }; // Traversable Id.prototype[fl.traverse] = function(f, of) { - // the of argument is only provided for types where map might fail. - return f(this.value)[fl.map](Id[fl.of]); + // the of argument is only provided for types where map might fail. + return f(this.value)[fl.map](Id[fl.of]); }; // Chain Id.prototype[fl.chain] = function(f) { - return f(this.value); + return f(this.value); }; // ChainRec Id[fl.chainRec] = function(f, i) { - var state = { done: false, value: i}; - var next = (v) => ({ done: false, value: v }); - var done = (v) => ({ done: true, value: v }); - while (state.done === false) { - state = f(next, done, state.value).value; - } - return new Id(state.value); + const next = v => ({done: false, value: v}); + const done = v => ({done: true, value: v}); + let state = {done: false, value: i}; + while (state.done === false) { + state = f(next, done, state.value).value; + } + return new Id(state.value); }; Id.prototype[fl.chainRec] = Id[fl.chainRec]; // Extend Id.prototype[fl.extend] = function(f) { - return new Id(f(this)); + return new Id(f(this)); }; // Applicative Id[fl.of] = function(a) { - return new Id(a); + return new Id(a); }; Id.prototype[fl.of] = Id[fl.of]; // Comonad Id.prototype[fl.extract] = function() { - return this.value; + return this.value; }; module.exports = Id; diff --git a/id_test.js b/id_test.js index c683584..7484d31 100644 --- a/id_test.js +++ b/id_test.js @@ -21,94 +21,94 @@ const Id = require('./id'); // Special type of sum for the type of string. const Sum = tagged('v'); -Sum[of] = (x) => Sum(x); +Sum[of] = Sum; Sum[empty] = () => Sum(''); Sum.prototype[of] = Sum[of]; Sum.prototype[empty] = Sum[empty]; Sum.prototype[map] = function(f) { - return Sum(f(this.v)); + return Sum(f(this.v)); }; Sum.prototype[concat] = function(x) { - return Sum(this.v + x.v); + return Sum(this.v + x.v); }; Sum.prototype[equals] = function(x) { - return this.v[equals] ? this.v[equals](x.v) : this.v === x.v; + return this.v[equals] ? this.v[equals](x.v) : this.v === x.v; }; const equality = (x, y) => x[equals] ? x[equals](y) : x === y; const test = f => t => { - t.ok(f("x")); - t.done(); + t.ok(f('x')); + t.done(); }; exports.applicative = { - identity: test((x) => applicative.identity(Id)(equality)(x)), - homomorphism: test((x) => applicative.homomorphism(Id)(equality)(x)), - interchange: test((x) => applicative.interchange(Id)(equality)(x)) + identity: test(x => applicative.identity(Id)(equality)(x)), + homomorphism: test(x => applicative.homomorphism(Id)(equality)(x)), + interchange: test(x => applicative.interchange(Id)(equality)(x)), }; exports.apply = { - composition: test((x) => apply.composition(Id)(equality)(x)) + composition: test(x => apply.composition(Id)(equality)(x)), }; exports.chain = { - associativity: test((x) => chain.associativity(Id)(equality)(x)) + associativity: test(x => chain.associativity(Id)(equality)(x)), }; exports.chainRec = { - equivalence: test((x) => { - var predicate = a => a.length > 5 - var done = Id[of] - var next = a => Id[of](a[concat]([x])) - var initial = [x] - return chainRec.equivalence(Id)(equality)(predicate)(done)(next)(initial) - }) + equivalence: test(x => { + const predicate = a => a.length > 5; + const done = Id[of]; + const next = a => Id[of](a[concat]([x])); + const initial = [x]; + return chainRec.equivalence(Id)(equality)(predicate)(done)(next)(initial); + }), }; exports.comonad = { - leftIdentity: test((x) => comonad.leftIdentity(Id[of])(equality)(x)), - rightIdentity: test((x) => comonad.rightIdentity(Id[of])(equality)(x)), - associativity: test((x) => comonad.associativity(Id[of])(equality)(x)) + leftIdentity: test(x => comonad.leftIdentity(Id[of])(equality)(x)), + rightIdentity: test(x => comonad.rightIdentity(Id[of])(equality)(x)), + associativity: test(x => comonad.associativity(Id[of])(equality)(x)), }; exports.extend = { - associativity: test((x) => extend.associativity(Id[of])(equality)(x)) + associativity: test(x => extend.associativity(Id[of])(equality)(x)), }; exports.foldable = { - associativity: test((x) => foldable.associativity(Id[of])(equality)(x)) + associativity: test(x => foldable.associativity(Id[of])(equality)(x)), }; exports.functor = { - identity: test((x) => functor.identity(Id[of])(equality)(x)), - composition: test((x) => functor.composition(Id[of])(equality)(x)) + identity: test(x => functor.identity(Id[of])(equality)(x)), + composition: test(x => functor.composition(Id[of])(equality)(x)), }; exports.monad = { - leftIdentity: test((x) => monad.leftIdentity(Id)(equality)(x)), - rightIdentity: test((x) => monad.rightIdentity(Id)(equality)(x)) + leftIdentity: test(x => monad.leftIdentity(Id)(equality)(x)), + rightIdentity: test(x => monad.rightIdentity(Id)(equality)(x)), }; exports.monoid = { - leftIdentity: test((x) => monoid.leftIdentity(Id[of](Sum[empty]()))(equality)(Sum[of](x))), - rightIdentity: test((x) => monoid.rightIdentity(Id[of](Sum[empty]()))(equality)(Sum[of](x))) + leftIdentity: test(x => monoid.leftIdentity(Id[of](Sum[empty]()))(equality)(Sum[of](x))), + rightIdentity: test(x => monoid.rightIdentity(Id[of](Sum[empty]()))(equality)(Sum[of](x))), }; // Semigroup tests are broken otherwise for this. -String.prototype[concat] = String.prototype.concat +String.prototype[concat] = String.prototype.concat; exports.semigroup = { - associativity: test((x) => semigroup.associativity(Id[of])(equality)(x)) + associativity: test(x => semigroup.associativity(Id[of])(equality)(x)), }; exports.setoid = { - reflexivity: test((x) => setoid.reflexivity(Id[of])(equality)(x)), - symmetry: test((x) => setoid.symmetry(Id[of])(equality)(x)), - transitivity: test((x) => setoid.transitivity(Id[of])(equality)(x)) + reflexivity: test(x => setoid.reflexivity(Id[of])(equality)(x)), + symmetry: test(x => setoid.symmetry(Id[of])(equality)(x)), + transitivity: test(x => setoid.transitivity(Id[of])(equality)(x)), }; exports.traversable = { - naturality: test((x) => traversable.naturality(Id[of])(equality)(Id[of](x))), - identity: test((x) => traversable.identity(Id[of])(equality)(x)), - composition: test((x) => traversable.composition(Id[of])(equality)(Id[of](Sum[of](x)))) + naturality: test(x => traversable.naturality(Id[of])(equality)(Id[of](x))), + identity: test(x => traversable.identity(Id[of])(equality)(x)), + composition: test(x => traversable.composition(Id[of])(equality)(Id[of](Sum[of](x)))), }; diff --git a/index.js b/index.js index 0877676..f1b04da 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,9 @@ 'use strict'; + /* eslint comma-dangle: ["off"], no-var: ["off"], strict: ["error", "function"] */ + /* global self */ + var mapping = { equals: 'fantasy-land/equals', concat: 'fantasy-land/concat', diff --git a/laws/applicative.js b/laws/applicative.js index d3ca796..bfd50c9 100644 --- a/laws/applicative.js +++ b/laws/applicative.js @@ -14,26 +14,23 @@ const {of, ap} = require('..'); **/ const identityʹ = t => eq => x => { - const a = t[of](x)[ap](t[of](identity)); - const b = t[of](x); - return eq(a, b); + const a = t[of](x)[ap](t[of](identity)); + const b = t[of](x); + return eq(a, b); }; const homomorphism = t => eq => x => { - const a = t[of](x)[ap](t[of](identity)); - const b = t[of](identity(x)); - return eq(a, b); + const a = t[of](x)[ap](t[of](identity)); + const b = t[of](identity(x)); + return eq(a, b); }; const interchange = t => eq => x => { - const u = t[of](identity); + const u = t[of](identity); - const a = t[of](x)[ap](u); - const b = u[ap](t[of](thrush(x))); - return eq(a, b); + const a = t[of](x)[ap](u); + const b = u[ap](t[of](thrush(x))); + return eq(a, b); }; -module.exports = { identity: identityʹ - , homomorphism - , interchange - }; +module.exports = {identity: identityʹ, homomorphism, interchange}; diff --git a/laws/apply.js b/laws/apply.js index 14bc254..999e8ec 100644 --- a/laws/apply.js +++ b/laws/apply.js @@ -12,11 +12,11 @@ const {of, map, ap} = require('..'); **/ const composition = t => eq => x => { - const y = t[of](identity); + const y = t[of](identity); - const a = y[ap](y[ap](y[map](compose))); - const b = y[ap](y)[ap](y); - return eq(a, b); + const a = y[ap](y[ap](y[map](compose))); + const b = y[ap](y)[ap](y); + return eq(a, b); }; -module.exports = { composition }; +module.exports = {composition}; diff --git a/laws/bifunctor.js b/laws/bifunctor.js index 468805f..f680cf7 100644 --- a/laws/bifunctor.js +++ b/laws/bifunctor.js @@ -12,17 +12,15 @@ const {bimap} = require('..'); **/ const identityʹ = t => eq => x => { - const a = t(x)[bimap](identity, identity); - const b = t(x); - return eq(a, b); + const a = t(x)[bimap](identity, identity); + const b = t(x); + return eq(a, b); }; const composition = t => eq => x => { - const a = t(x)[bimap](compose(identity)(identity), compose(identity)(identity)); - const b = t(x)[bimap](identity, identity)[bimap](identity, identity); - return eq(a, b); + const a = t(x)[bimap](compose(identity)(identity), compose(identity)(identity)); + const b = t(x)[bimap](identity, identity)[bimap](identity, identity); + return eq(a, b); }; -modules.exports = { identity: identityʹ - , composition - }; +module.exports = {identity: identityʹ, composition}; diff --git a/laws/chain.js b/laws/chain.js index 8044fd5..4e6dc0d 100644 --- a/laws/chain.js +++ b/laws/chain.js @@ -11,9 +11,9 @@ const {of, chain} = require('..'); **/ const associativity = t => eq => x => { - const a = t[of](x)[chain](t[of])[chain](t[of]); - const b = t[of](x)[chain]((x) => t[of](x)[chain](t[of])); - return eq(a, b); + const a = t[of](x)[chain](t[of])[chain](t[of]); + const b = t[of](x)[chain](x => t[of](x)[chain](t[of])); + return eq(a, b); }; -module.exports = { associativity }; +module.exports = {associativity}; diff --git a/laws/chainrec.js b/laws/chainrec.js index a36e832..4fa652f 100644 --- a/laws/chainrec.js +++ b/laws/chainrec.js @@ -1,9 +1,7 @@ 'use strict'; -const {identity} = require('fantasy-combinators'); const {chain, map, chainRec} = require('..'); - /** ### ChainRec @@ -15,9 +13,9 @@ const {chain, map, chainRec} = require('..'); **/ const equivalence = t => eq => p => d => n => x => { - const a = t[chainRec]((next, done, v) => p(v) ? d(v)[map](done) : n(v)[map](next), x); - const b = (function step(v) { return p(v) ? d(v) : n(v)[chain](step); }(x)); - return eq(a, b); + const a = t[chainRec]((next, done, v) => p(v) ? d(v)[map](done) : n(v)[map](next), x); + const b = (function step(v) { return p(v) ? d(v) : n(v)[chain](step); }(x)); + return eq(a, b); }; -module.exports = { equivalence }; +module.exports = {equivalence}; diff --git a/laws/comonad.js b/laws/comonad.js index 35c7de2..df6ae08 100644 --- a/laws/comonad.js +++ b/laws/comonad.js @@ -14,24 +14,21 @@ const {extend, map, extract} = require('..'); **/ const leftIdentity = t => eq => x => { - const a = t(x)[extend](identity)[extract](); - const b = t(x); - return eq(a, b); + const a = t(x)[extend](identity)[extract](); + const b = t(x); + return eq(a, b); }; const rightIdentity = t => eq => x => { - const a = t(x)[extend](w => w[extract]()); - const b = t(x); - return eq(a, b); + const a = t(x)[extend](w => w[extract]()); + const b = t(x); + return eq(a, b); }; const associativity = t => eq => x => { - const a = t(x)[extend](identity); - const b = t(x)[extend](identity)[map](identity); - return eq(a, b); + const a = t(x)[extend](identity); + const b = t(x)[extend](identity)[map](identity); + return eq(a, b); }; -module.exports = { leftIdentity - , rightIdentity - , associativity - }; +module.exports = {leftIdentity, rightIdentity, associativity}; diff --git a/laws/extend.js b/laws/extend.js index dcf4b8a..310cc7b 100644 --- a/laws/extend.js +++ b/laws/extend.js @@ -12,9 +12,9 @@ const {extend} = require('..'); **/ const associativity = t => eq => x => { - const a = t(x)[extend](identity)[extend](identity); - const b = t(x)[extend](w => identity(w[extend](identity))); - return eq(a, b); + const a = t(x)[extend](identity)[extend](identity); + const b = t(x)[extend](w => identity(w[extend](identity))); + return eq(a, b); }; -module.exports = { associativity }; +module.exports = {associativity}; diff --git a/laws/foldable.js b/laws/foldable.js index c48d583..2c1b895 100644 --- a/laws/foldable.js +++ b/laws/foldable.js @@ -3,7 +3,6 @@ const {identity} = require('fantasy-combinators'); const {reduce} = require('..'); - /** ### Foldable @@ -13,9 +12,9 @@ const {reduce} = require('..'); **/ const associativity = t => eq => x => { - const a = t(x)[reduce](identity, x); - const b = t(x).toArray()[reduce](identity, x); - return eq(a, b); + const a = t(x)[reduce](identity, x); + const b = t(x).toArray()[reduce](identity, x); + return eq(a, b); }; -module.exports = { associativity }; +module.exports = {associativity}; diff --git a/laws/functor.js b/laws/functor.js index 6d7414f..1f16bcd 100644 --- a/laws/functor.js +++ b/laws/functor.js @@ -2,27 +2,25 @@ const {map} = require('..'); -/* +/** ### Functor 1. `u.map(a => a)` is equivalent to `u` (identity) 2. `u.map(x => f(g(x)))` is equivalent to `u.map(g).map(f)` (composition) -*/ +**/ const identity = of => eq => x => { - const a = of(x)[map](x => x); - const b = of(x); - return eq(a, b); + const a = of(x)[map](x => x); + const b = of(x); + return eq(a, b); }; const composition = of => eq => x => f => g => { - const a = of(x)[map](x => f(g(x))); - const b = of(x)[map](g)[map](f); - return eq(a, b); + const a = of(x)[map](x => f(g(x))); + const b = of(x)[map](g)[map](f); + return eq(a, b); }; -module.exports = { identity - , composition - }; +module.exports = {identity, composition}; diff --git a/laws/monad.js b/laws/monad.js index aef9923..8527d8f 100644 --- a/laws/monad.js +++ b/laws/monad.js @@ -12,17 +12,15 @@ const {of, chain} = require('..'); **/ const leftIdentity = t => eq => x => f => { - const a = t[of](x)[chain](f); - const b = f(x); - return eq(a, b); + const a = t[of](x)[chain](f); + const b = f(x); + return eq(a, b); }; const rightIdentity = t => eq => x => { - const a = t[of](x)[chain](t[of]); - const b = t[of](x); - return eq(a, b); + const a = t[of](x)[chain](t[of]); + const b = t[of](x); + return eq(a, b); }; -module.exports = { leftIdentity - , rightIdentity - }; +module.exports = {leftIdentity, rightIdentity}; diff --git a/laws/monoid.js b/laws/monoid.js index 25ac8e9..800509c 100644 --- a/laws/monoid.js +++ b/laws/monoid.js @@ -1,6 +1,5 @@ 'use strict'; -const {identity, apply} = require('fantasy-combinators'); const {of, empty, concat} = require('..'); /** @@ -13,17 +12,15 @@ const {of, empty, concat} = require('..'); **/ const rightIdentity = t => eq => x => { - const a = t[of](x)[concat](t[empty]()); - const b = t[of](x); - return eq(a, b); + const a = t[of](x)[concat](t[empty]()); + const b = t[of](x); + return eq(a, b); }; const leftIdentity = t => eq => x => { - const a = t[empty]()[concat](t[of](x)); - const b = t[of](x); - return eq(a, b); + const a = t[empty]()[concat](t[of](x)); + const b = t[of](x); + return eq(a, b); }; -module.exports = { rightIdentity - , leftIdentity - }; \ No newline at end of file +module.exports = {rightIdentity, leftIdentity}; diff --git a/laws/profunctor.js b/laws/profunctor.js index cdb335b..128cbc5 100644 --- a/laws/profunctor.js +++ b/laws/profunctor.js @@ -12,17 +12,15 @@ const {promap} = require('..'); **/ const identityʹ = t => eq => x => { - const a = t(x)[promap](identity, identity); - const b = t(x); - return eq(a, b); + const a = t(x)[promap](identity, identity); + const b = t(x); + return eq(a, b); }; const composition = t => eq => x => { - const a = t(x)[promap](compose(identity)(identity), compose(identity)(identity)); - const b = t(x)[promap](identity, identity)[promap](identity, identity); - return eq(a, b); + const a = t(x)[promap](compose(identity)(identity), compose(identity)(identity)); + const b = t(x)[promap](identity, identity)[promap](identity, identity); + return eq(a, b); }; -module.exports = { identity: identityʹ - , composition - }; +module.exports = {identity: identityʹ, composition}; diff --git a/laws/semigroup.js b/laws/semigroup.js index 1b5f3bf..d2a85d3 100644 --- a/laws/semigroup.js +++ b/laws/semigroup.js @@ -1,6 +1,5 @@ 'use strict'; -const {identity, apply} = require('fantasy-combinators'); const {concat} = require('..'); /** @@ -12,13 +11,13 @@ const {concat} = require('..'); **/ const associativity = t => eq => x => { - const f = t(x); - const g = t(x); - const h = t(x); + const f = t(x); + const g = t(x); + const h = t(x); - const a = f[concat](g)[concat](h); - const b = f[concat](g[concat](h)); - return eq(a, b); + const a = f[concat](g)[concat](h); + const b = f[concat](g[concat](h)); + return eq(a, b); }; -module.exports = { associativity }; +module.exports = {associativity}; diff --git a/laws/setoid.js b/laws/setoid.js index 13c6a6b..740bee3 100644 --- a/laws/setoid.js +++ b/laws/setoid.js @@ -1,6 +1,5 @@ 'use strict'; -const {identity, apply} = require('fantasy-combinators'); const {equals} = require('..'); /** @@ -14,34 +13,31 @@ const {equals} = require('..'); **/ const reflexivity = t => eq => x => { - const y = t(x); + const y = t(x); - const a = y[equals](y); - const b = true; - return eq(a, b); + const a = y[equals](y); + const b = true; + return eq(a, b); }; const symmetry = t => eq => x => { - const f = t(x); - const g = t(x); + const f = t(x); + const g = t(x); - const a = f[equals](g); - const b = g[equals](f); - return eq(a, b); + const a = f[equals](g); + const b = g[equals](f); + return eq(a, b); }; const transitivity = t => eq => x => { - const f = t(x); - const g = t(x); - const h = t(x); - - const a = f[equals](g); - const b = g[equals](h); - const c = f[equals](h); - return eq(a && b, c); + const f = t(x); + const g = t(x); + const h = t(x); + + const a = f[equals](g); + const b = g[equals](h); + const c = f[equals](h); + return eq(a && b, c); }; -module.exports = { reflexivity - , symmetry - , transitivity - }; \ No newline at end of file +module.exports = {reflexivity, symmetry, transitivity}; diff --git a/laws/traversable.js b/laws/traversable.js index 507d52d..031ae2f 100644 --- a/laws/traversable.js +++ b/laws/traversable.js @@ -2,34 +2,35 @@ const Id = require('../id'); const {identity} = require('fantasy-combinators'); -const {of, ap, reduce, traverse, map, equals, empty, concat} = require('..'); +const {of, ap, reduce, traverse, map, equals, concat} = require('..'); const {tagged} = require('daggy'); const Compose = tagged('c'); Compose[of] = Compose; Compose.prototype[ap] = function(f) { - return Compose(this.c[ap](f.c[map](u => y => y[ap](u)))); + return Compose(this.c[ap](f.c[map](u => y => y[ap](u)))); }; Compose.prototype[map] = function(f) { - return Compose(this.c[map](y => y[map](f))); + return Compose(this.c[map](y => y[map](f))); }; Compose.prototype[equals] = function(x) { - return this.c[equals] ? this.c[equals](x.c) : this.c === x.c; + return this.c[equals] ? this.c[equals](x.c) : this.c === x.c; }; Array.prototype[equals] = function(y) { - return this.length === y.length && this.join('') === y.join(''); + return this.length === y.length && this.join('') === y.join(''); }; -Array.prototype[map] = Array.prototype.map -Array.prototype[reduce] = Array.prototype.reduce -Array.prototype[concat] = Array.prototype.concat +Array.prototype[map] = Array.prototype.map; +Array.prototype[reduce] = Array.prototype.reduce; +Array.prototype[concat] = Array.prototype.concat; Array.prototype[traverse] = function(f, p) { - return this.map(f)[reduce]((ys, x) => { - return ys[ap](x[map](y => z => z[concat](y))); - }, p([])); + return this.map(f)[reduce]( + (ys, x) => ys[ap](x[map](y => z => z[concat](y))), + p([]) + ); }; -/* +/** ### Traversable @@ -41,29 +42,26 @@ for any `t` such that `t(a).map(f)` is equivalent to `t(a.map(f))` (naturality) 3. `u.traverse(x => new Compose(x), Compose.of)` is equivalent to `new Compose(u.traverse(x => x, F.of).map(x => x.traverse(x => x, G.of)))` for `Compose` defined below and any Applicatives `F` and `G` (composition) -*/ +**/ const naturality = t => eq => x => { - const a = identity(t(x)[traverse](y => y, t[of])); - const b = t(x)[traverse](identity, t[of]); - return eq(a, b); + const a = identity(t(x)[traverse](y => y, t[of])); + const b = t(x)[traverse](identity, t[of]); + return eq(a, b); }; const identityʹ = t => eq => x => { - const u = [x]; + const u = [x]; - const a = u[traverse](Id[of], Id[of]); - const b = Id[of](u); - return eq(a, b); + const a = u[traverse](Id[of], Id[of]); + const b = Id[of](u); + return eq(a, b); }; const composition = t => eq => x => { - const a = t(x)[traverse](Compose, Compose[of]); - const b = Compose(t(x)[traverse](y => y, Id[of])[map](x => x[traverse](y => y, Id[of]))); - return eq(a, b); + const a = t(x)[traverse](Compose, Compose[of]); + const b = Compose(t(x)[traverse](y => y, Id[of])[map](x => x[traverse](y => y, Id[of]))); + return eq(a, b); }; -module.exports = { naturality - , identity: identityʹ - , composition - }; +module.exports = {naturality, identity: identityʹ, composition}; diff --git a/package.json b/package.json index ab2786f..e2f7a91 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,9 @@ "fantasy-combinators": "0.0.x" }, "devDependencies": { - "nodeunit": "0.9.x" + "eslint": "3.8.x", + "nodeunit": "0.9.x", + "sanctuary-style": "0.2.x" }, "repository": { "type": "git", @@ -36,6 +38,7 @@ ], "main": "index.js", "scripts": { - "test": "nodeunit id_test.js" + "lint": "eslint --config node_modules/sanctuary-style/eslint-es6.json --env es6 --env node --rule 'max-len: [off]' -- *.js laws/*.js", + "test": "npm run-script lint && nodeunit id_test.js" } }