diff --git a/.eslintignore b/.eslintignore index 0595a1b5..38281280 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,5 @@ **/build/* **/docs/* **/coverage/* +**/tests/* +**/_book/* diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 00000000..31354ec1 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..d0612ad3 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run pre-commit diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 00000000..449fcdee --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm test diff --git a/TROUBLESHOOT.MD b/TROUBLESHOOT.MD new file mode 100644 index 00000000..0ff5f86e --- /dev/null +++ b/TROUBLESHOOT.MD @@ -0,0 +1,8 @@ +## Husky - cannot execute pre-commit hook. +`make sure to have chmod +x set on it correctly` + +## Husky - EEXIST: (...) "'.husky/_'" +`you can manually remove .husky/_ folder` + +## Tests not passing +`make sure your gnache-cli is running (npm run gnache:start) in a seprate terminal instance` diff --git a/_book/gitbook/gitbook.js b/_book/gitbook/gitbook.js index 5b960c04..6ef41a57 100644 --- a/_book/gitbook/gitbook.js +++ b/_book/gitbook/gitbook.js @@ -25,7 +25,7 @@ }, preFilter: { ATTR(e) { return e[1] = e[1].replace(xe, be), e[3] = (e[3] || e[4] || e[5] || '').replace(xe, be), e[2] === '~=' && (e[3] = ` ${e[3]} `), e.slice(0, 4); }, CHILD(e) { return e[1] = e[1].toLowerCase(), e[1].slice(0, 3) === 'nth' ? (e[3] || t.error(e[0]), e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * (e[3] === 'even' || e[3] === 'odd')), e[5] = +(e[7] + e[8] || e[3] === 'odd')) : e[3] && t.error(e[0]), e; }, PSEUDO(e) { let t; const n = !e[6] && e[2]; return he.CHILD.test(e[0]) ? null : (e[3] ? e[2] = e[4] || e[5] || '' : n && fe.test(n) && (t = E(n, !0)) && (t = n.indexOf(')', n.length - t) - n.length) && (e[0] = e[0].slice(0, t), e[2] = n.slice(0, t)), e.slice(0, 3)); } }, filter: { - TAG(e) { const t = e.replace(xe, be).toLowerCase(); return e === '*' ? function () { return !0; } : function (e) { return e.nodeName && e.nodeName.toLowerCase() === t; }; }, CLASS(e) { let t = U[`${e} `]; return t || (t = new RegExp(`(^|${ne})${e}(${ne}|$)`)) && U(e, e => t.test(typeof e.className == 'string' && e.className || typeof e.getAttribute !== 'undefined' && e.getAttribute('class') || '')); }, ATTR(e, n, r) { return function (o) { let i = t.attr(o, e); return i == null ? n === '!=' : !n || (i += '', n === '=' ? i === r : n === '!=' ? i !== r : n === '^=' ? r && i.indexOf(r) === 0 : n === '*=' ? r && i.indexOf(r) > -1 : n === '$=' ? r && i.slice(-r.length) === r : n === '~=' ? (` ${i.replace(se, ' ')} `).indexOf(r) > -1 : n === '|=' && (i === r || i.slice(0, r.length + 1) === `${r}-`)); }; }, CHILD(e, t, n, r, o) { const i = e.slice(0, 3) !== 'nth'; const s = e.slice(-4) !== 'last'; const a = t === 'of-type'; return r === 1 && o === 0 ? function (e) { return !!e.parentNode; } : function (t, n, u) { let c; let l; let f; let p; let h; let d; let g = i !== s ? 'nextSibling' : 'previousSibling'; const m = t.parentNode; const v = a && t.nodeName.toLowerCase(); const y = !u && !a; let x = !1; if (m) { if (i) { for (;g;) { for (p = t; p = p[g];) if (a ? p.nodeName.toLowerCase() === v : p.nodeType === 1) return !1; d = g = e === 'only' && !d && 'nextSibling'; } return !0; } if (d = [s ? m.firstChild : m.lastChild], s && y) { for (p = m, f = p[$] || (p[$] = {}), l = f[p.uniqueID] || (f[p.uniqueID] = {}), c = l[e] || [], h = c[0] === B && c[1], x = h && c[2], p = h && m.childNodes[h]; p = ++h && p && p[g] || (x = h = 0) || d.pop();) if (p.nodeType === 1 && ++x && p === t) { l[e] = [B, h, x]; break; } } else if (y && (p = t, f = p[$] || (p[$] = {}), l = f[p.uniqueID] || (f[p.uniqueID] = {}), c = l[e] || [], h = c[0] === B && c[1], x = h), x === !1) for (;(p = ++h && p && p[g] || (x = h = 0) || d.pop()) && ((a ? p.nodeName.toLowerCase() !== v : p.nodeType !== 1) || !++x || (y && (f = p[$] || (p[$] = {}), l = f[p.uniqueID] || (f[p.uniqueID] = {}), l[e] = [B, x]), p !== t)););return x -= o, x === r || x % r === 0 && x / r >= 0; } }; }, PSEUDO(e, n) { let o; const i = C.pseudos[e] || C.setFilters[e.toLowerCase()] || t.error(`unsupported pseudo: ${e}`); return i[$] ? i(n) : i.length > 1 ? (o = [e, e, '', n], C.setFilters.hasOwnProperty(e.toLowerCase()) ? r((e, t) => { for (var r, o = i(e, n), s = o.length; s--;)r = ee(e, o[s]), e[r] = !(t[r] = o[s]); }) : function (e) { return i(e, 0, o); }) : i; }, + TAG(e) { const t = e.replace(xe, be).toLowerCase(); return e === '*' ? function () { return !0; } : function (e) { return e.nodeName && e.nodeName.toLowerCase() === t; }; }, CLASS(e) { let t = U[`${e} `]; return t || (t = new RegExp(`(^|${ne})${e}(${ne}|$)`)) && U(e, e => t.test(typeof e.className === 'string' && e.className || typeof e.getAttribute !== 'undefined' && e.getAttribute('class') || '')); }, ATTR(e, n, r) { return function (o) { let i = t.attr(o, e); return i == null ? n === '!=' : !n || (i += '', n === '=' ? i === r : n === '!=' ? i !== r : n === '^=' ? r && i.indexOf(r) === 0 : n === '*=' ? r && i.indexOf(r) > -1 : n === '$=' ? r && i.slice(-r.length) === r : n === '~=' ? (` ${i.replace(se, ' ')} `).indexOf(r) > -1 : n === '|=' && (i === r || i.slice(0, r.length + 1) === `${r}-`)); }; }, CHILD(e, t, n, r, o) { const i = e.slice(0, 3) !== 'nth'; const s = e.slice(-4) !== 'last'; const a = t === 'of-type'; return r === 1 && o === 0 ? function (e) { return !!e.parentNode; } : function (t, n, u) { let c; let l; let f; let p; let h; let d; let g = i !== s ? 'nextSibling' : 'previousSibling'; const m = t.parentNode; const v = a && t.nodeName.toLowerCase(); const y = !u && !a; let x = !1; if (m) { if (i) { for (;g;) { for (p = t; p = p[g];) if (a ? p.nodeName.toLowerCase() === v : p.nodeType === 1) return !1; d = g = e === 'only' && !d && 'nextSibling'; } return !0; } if (d = [s ? m.firstChild : m.lastChild], s && y) { for (p = m, f = p[$] || (p[$] = {}), l = f[p.uniqueID] || (f[p.uniqueID] = {}), c = l[e] || [], h = c[0] === B && c[1], x = h && c[2], p = h && m.childNodes[h]; p = ++h && p && p[g] || (x = h = 0) || d.pop();) if (p.nodeType === 1 && ++x && p === t) { l[e] = [B, h, x]; break; } } else if (y && (p = t, f = p[$] || (p[$] = {}), l = f[p.uniqueID] || (f[p.uniqueID] = {}), c = l[e] || [], h = c[0] === B && c[1], x = h), x === !1) for (;(p = ++h && p && p[g] || (x = h = 0) || d.pop()) && ((a ? p.nodeName.toLowerCase() !== v : p.nodeType !== 1) || !++x || (y && (f = p[$] || (p[$] = {}), l = f[p.uniqueID] || (f[p.uniqueID] = {}), l[e] = [B, x]), p !== t)););return x -= o, x === r || x % r === 0 && x / r >= 0; } }; }, PSEUDO(e, n) { let o; const i = C.pseudos[e] || C.setFilters[e.toLowerCase()] || t.error(`unsupported pseudo: ${e}`); return i[$] ? i(n) : i.length > 1 ? (o = [e, e, '', n], C.setFilters.hasOwnProperty(e.toLowerCase()) ? r((e, t) => { for (var r, o = i(e, n), s = o.length; s--;)r = ee(e, o[s]), e[r] = !(t[r] = o[s]); }) : function (e) { return i(e, 0, o); }) : i; }, }, pseudos: { not: r((e) => { const t = []; const n = []; const o = S(e.replace(ae, '$1')); return o[$] ? r((e, t, n, r) => { for (var i, s = o(e, null, r, []), a = e.length; a--;)(i = s[a]) && (e[a] = !(t[a] = i)); }) : function (e, r, i) { return t[0] = e, o(t, null, i, n), t[0] = null, !n.pop(); }; }), @@ -73,7 +73,7 @@ }, de.extend({ Deferred(t) { const n = [['notify', 'progress', de.Callbacks('memory'), de.Callbacks('memory'), 2], ['resolve', 'done', de.Callbacks('once memory'), de.Callbacks('once memory'), 0, 'resolved'], ['reject', 'fail', de.Callbacks('once memory'), de.Callbacks('once memory'), 1, 'rejected']]; let r = 'pending'; var o = { - state() { return r; }, always() { return i.done(arguments).fail(arguments), this; }, catch(e) { return o.then(null, e); }, pipe() { let e = arguments; return de.Deferred((t) => { de.each(n, (n, r) => { let o = de.isFunction(e[r[4]]) && e[r[4]]; i[r[1]](function () { let e = o && o.apply(this, arguments); e && de.isFunction(e.promise) ? e.promise().progress(t.notify).done(t.resolve).fail(t.reject) : t[`${r[0]}With`](this, o ? [e] : arguments); }); }), e = null; }).promise(); }, then(t, r, o) { function i(t, n, r, o) { return function () { let c = this; let l = arguments; const f = function () { let e; let f; if (!(t < s)) { if (e = r.apply(c, l), e === n.promise()) throw new TypeError('Thenable self-resolution'); f = e && (typeof e == 'object' || typeof e === 'function') && e.then, de.isFunction(f) ? o ? f.call(e, i(s, n, a, o), i(s, n, u, o)) : (s++, f.call(e, i(s, n, a, o), i(s, n, u, o), i(s, n, a, n.notifyWith))) : (r !== a && (c = void 0, l = [e]), (o || n.resolveWith)(c, l)); } }; var p = o ? f : function () { try { f(); } catch (e) { de.Deferred.exceptionHook && de.Deferred.exceptionHook(e, p.stackTrace), t + 1 >= s && (r !== u && (c = void 0, l = [e]), n.rejectWith(c, l)); } }; t ? p() : (de.Deferred.getStackHook && (p.stackTrace = de.Deferred.getStackHook()), e.setTimeout(p)); }; } var s = 0; return de.Deferred((e) => { n[0][3].add(i(0, e, de.isFunction(o) ? o : a, e.notifyWith)), n[1][3].add(i(0, e, de.isFunction(t) ? t : a)), n[2][3].add(i(0, e, de.isFunction(r) ? r : u)); }).promise(); }, promise(e) { return e != null ? de.extend(e, o) : o; }, + state() { return r; }, always() { return i.done(arguments).fail(arguments), this; }, catch(e) { return o.then(null, e); }, pipe() { let e = arguments; return de.Deferred((t) => { de.each(n, (n, r) => { const o = de.isFunction(e[r[4]]) && e[r[4]]; i[r[1]](function () { const e = o && o.apply(this, arguments); e && de.isFunction(e.promise) ? e.promise().progress(t.notify).done(t.resolve).fail(t.reject) : t[`${r[0]}With`](this, o ? [e] : arguments); }); }), e = null; }).promise(); }, then(t, r, o) { function i(t, n, r, o) { return function () { let c = this; let l = arguments; const f = function () { let e; let f; if (!(t < s)) { if (e = r.apply(c, l), e === n.promise()) throw new TypeError('Thenable self-resolution'); f = e && (typeof e === 'object' || typeof e === 'function') && e.then, de.isFunction(f) ? o ? f.call(e, i(s, n, a, o), i(s, n, u, o)) : (s++, f.call(e, i(s, n, a, o), i(s, n, u, o), i(s, n, a, n.notifyWith))) : (r !== a && (c = void 0, l = [e]), (o || n.resolveWith)(c, l)); } }; var p = o ? f : function () { try { f(); } catch (e) { de.Deferred.exceptionHook && de.Deferred.exceptionHook(e, p.stackTrace), t + 1 >= s && (r !== u && (c = void 0, l = [e]), n.rejectWith(c, l)); } }; t ? p() : (de.Deferred.getStackHook && (p.stackTrace = de.Deferred.getStackHook()), e.setTimeout(p)); }; } var s = 0; return de.Deferred((e) => { n[0][3].add(i(0, e, de.isFunction(o) ? o : a, e.notifyWith)), n[1][3].add(i(0, e, de.isFunction(t) ? t : a)), n[2][3].add(i(0, e, de.isFunction(r) ? r : u)); }).promise(); }, promise(e) { return e != null ? de.extend(e, o) : o; }, }; var i = {}; return de.each(n, (e, t) => { const s = t[2]; const a = t[5]; o[t[1]] = s.add, a && s.add(() => { r = a; }, n[3 - e][2].disable, n[0][2].lock), s.add(t[3].fire), i[t[0]] = function () { return i[`${t[0]}With`](this === i ? void 0 : this, arguments), this; }, i[`${t[0]}With`] = s.fireWith; }), o.promise(i), t && t.call(i, i), i; }, when(e) { let t = arguments.length; let n = t; const r = Array(n); const o = re.call(arguments); const i = de.Deferred(); const s = function (e) { return function (n) { r[e] = this, o[e] = arguments.length > 1 ? re.call(arguments) : n, --t || i.resolveWith(r, o); }; }; if (t <= 1 && (c(e, i.done(s(n)).resolve, i.reject), i.state() === 'pending' || de.isFunction(o[n] && o[n].then))) return i.then(); for (;n--;)c(o[n], s(n), i.reject); return i.promise(); }, @@ -93,11 +93,11 @@ add(e, t, n, r, o) { let i; let s; let a; let u; let c; let l; let f; let p; let h; let d; let g; const m = Fe.get(e); if (m) { for (n.handler && (i = n, n = i.handler, o = i.selector), o && de.find.matchesSelector(Qe, o), n.guid || (n.guid = de.guid++), (u = m.events) || (u = m.events = {}), (s = m.handle) || (s = m.handle = function (t) { return typeof de !== 'undefined' && de.event.triggered !== t.type ? de.event.dispatch.apply(e, arguments) : void 0; }), t = (t || '').match(qe) || [''], c = t.length; c--;) { - a = Ze.exec(t[c]) || [], h = g = a[1], d = (a[2] || '').split('.').sort(), h && (f = de.event.special[h] || {}, h = (o ? f.delegateType : f.bindType) || h, f = de.event.special[h] || {}, l = de.extend({ - type: h, origType: g, data: r, handler: n, guid: n.guid, selector: o, needsContext: o && de.expr.match.needsContext.test(o), namespace: d.join('.'), - }, i), (p = u[h]) || (p = u[h] = [], p.delegateCount = 0, f.setup && f.setup.call(e, r, d, s) !== !1 || e.addEventListener && e.addEventListener(h, s)), f.add && (f.add.call(e, l), l.handler.guid || (l.handler.guid = n.guid)), o ? p.splice(p.delegateCount++, 0, l) : p.push(l), de.event.global[h] = !0); -} -} + a = Ze.exec(t[c]) || [], h = g = a[1], d = (a[2] || '').split('.').sort(), h && (f = de.event.special[h] || {}, h = (o ? f.delegateType : f.bindType) || h, f = de.event.special[h] || {}, l = de.extend({ + type: h, origType: g, data: r, handler: n, guid: n.guid, selector: o, needsContext: o && de.expr.match.needsContext.test(o), namespace: d.join('.'), + }, i), (p = u[h]) || (p = u[h] = [], p.delegateCount = 0, f.setup && f.setup.call(e, r, d, s) !== !1 || e.addEventListener && e.addEventListener(h, s)), f.add && (f.add.call(e, l), l.handler.guid || (l.handler.guid = n.guid)), o ? p.splice(p.delegateCount++, 0, l) : p.push(l), de.event.global[h] = !0); + } + } }, remove(e, t, n, r, o) { let i; let s; let a; let u; let c; let l; let f; let p; let h; let d; let g; const m = Fe.hasData(e) && Fe.get(e); if (m && (u = m.events)) { for (t = (t || '').match(qe) || [''], c = t.length; c--;) if (a = Ze.exec(t[c]) || [], h = g = a[1], d = (a[2] || '').split('.').sort(), h) { for (f = de.event.special[h] || {}, h = (r ? f.delegateType : f.bindType) || h, p = u[h] || [], a = a[2] && new RegExp(`(^|\\.)${d.join('\\.(?:.*\\.|)')}(\\.|$)`), s = i = p.length; i--;)l = p[i], !o && g !== l.origType || n && n.guid !== l.guid || a && !a.test(l.namespace) || r && r !== l.selector && (r !== '**' || !l.selector) || (p.splice(i, 1), l.selector && p.delegateCount--, f.remove && f.remove.call(e, l)); s && !p.length && (f.teardown && f.teardown.call(e, d, m.handle) !== !1 || de.removeEvent(e, h, m.handle), delete u[h]); } else for (h in u)de.event.remove(e, h + t[c], n, r, !0); de.isEmptyObject(u) && Fe.remove(e, 'handle events'); } }, dispatch(e) { let t; let n; let r; let o; let i; let s; const a = de.event.fix(e); const u = new Array(arguments.length); const c = (Fe.get(this, 'events') || {})[a.type] || []; const l = de.event.special[a.type] || {}; for (u[0] = a, t = 1; t < arguments.length; t++)u[t] = arguments[t]; if (a.delegateTarget = this, !l.preDispatch || l.preDispatch.call(this, a) !== !1) { for (s = de.event.handlers.call(this, a, c), t = 0; (o = s[t++]) && !a.isPropagationStopped();) for (a.currentTarget = o.elem, n = 0; (i = o.handlers[n++]) && !a.isImmediatePropagationStopped();)a.rnamespace && !a.rnamespace.test(i.namespace) || (a.handleObj = i, a.data = i.data, r = ((de.event.special[i.origType] || {}).handle || i.handler).apply(o.elem, u), void 0 !== r && (a.result = r) === !1 && (a.preventDefault(), a.stopPropagation())); return l.postDispatch && l.postDispatch.call(this, a), a.result; } }, diff --git a/_book/gitbook/theme.js b/_book/gitbook/theme.js index a3c5646d..0baca924 100644 --- a/_book/gitbook/theme.js +++ b/_book/gitbook/theme.js @@ -25,7 +25,7 @@ }, preFilter: { ATTR(e) { return e[1] = e[1].replace(be, xe), e[3] = (e[3] || e[4] || e[5] || '').replace(be, xe), e[2] === '~=' && (e[3] = ` ${e[3]} `), e.slice(0, 4); }, CHILD(e) { return e[1] = e[1].toLowerCase(), e[1].slice(0, 3) === 'nth' ? (e[3] || t.error(e[0]), e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * (e[3] === 'even' || e[3] === 'odd')), e[5] = +(e[7] + e[8] || e[3] === 'odd')) : e[3] && t.error(e[0]), e; }, PSEUDO(e) { let t; const n = !e[6] && e[2]; return he.CHILD.test(e[0]) ? null : (e[3] ? e[2] = e[4] || e[5] || '' : n && fe.test(n) && (t = E(n, !0)) && (t = n.indexOf(')', n.length - t) - n.length) && (e[0] = e[0].slice(0, t), e[2] = n.slice(0, t)), e.slice(0, 3)); } }, filter: { - TAG(e) { const t = e.replace(be, xe).toLowerCase(); return e === '*' ? function () { return !0; } : function (e) { return e.nodeName && e.nodeName.toLowerCase() === t; }; }, CLASS(e) { let t = U[`${e} `]; return t || (t = new RegExp(`(^|${ne})${e}(${ne}|$)`)) && U(e, e => t.test(typeof e.className == 'string' && e.className || typeof e.getAttribute !== 'undefined' && e.getAttribute('class') || '')); }, ATTR(e, n, r) { return function (o) { let i = t.attr(o, e); return i == null ? n === '!=' : !n || (i += '', n === '=' ? i === r : n === '!=' ? i !== r : n === '^=' ? r && i.indexOf(r) === 0 : n === '*=' ? r && i.indexOf(r) > -1 : n === '$=' ? r && i.slice(-r.length) === r : n === '~=' ? (` ${i.replace(ae, ' ')} `).indexOf(r) > -1 : n === '|=' && (i === r || i.slice(0, r.length + 1) === `${r}-`)); }; }, CHILD(e, t, n, r, o) { const i = e.slice(0, 3) !== 'nth'; const a = e.slice(-4) !== 'last'; const s = t === 'of-type'; return r === 1 && o === 0 ? function (e) { return !!e.parentNode; } : function (t, n, u) { let l; let c; let f; let p; let h; let d; let g = i !== a ? 'nextSibling' : 'previousSibling'; const m = t.parentNode; const v = s && t.nodeName.toLowerCase(); const y = !u && !s; let b = !1; if (m) { if (i) { for (;g;) { for (p = t; p = p[g];) if (s ? p.nodeName.toLowerCase() === v : p.nodeType === 1) return !1; d = g = e === 'only' && !d && 'nextSibling'; } return !0; } if (d = [a ? m.firstChild : m.lastChild], a && y) { for (p = m, f = p[$] || (p[$] = {}), c = f[p.uniqueID] || (f[p.uniqueID] = {}), l = c[e] || [], h = l[0] === W && l[1], b = h && l[2], p = h && m.childNodes[h]; p = ++h && p && p[g] || (b = h = 0) || d.pop();) if (p.nodeType === 1 && ++b && p === t) { c[e] = [W, h, b]; break; } } else if (y && (p = t, f = p[$] || (p[$] = {}), c = f[p.uniqueID] || (f[p.uniqueID] = {}), l = c[e] || [], h = l[0] === W && l[1], b = h), b === !1) for (;(p = ++h && p && p[g] || (b = h = 0) || d.pop()) && ((s ? p.nodeName.toLowerCase() !== v : p.nodeType !== 1) || !++b || (y && (f = p[$] || (p[$] = {}), c = f[p.uniqueID] || (f[p.uniqueID] = {}), c[e] = [W, b]), p !== t)););return b -= o, b === r || b % r === 0 && b / r >= 0; } }; }, PSEUDO(e, n) { let o; const i = T.pseudos[e] || T.setFilters[e.toLowerCase()] || t.error(`unsupported pseudo: ${e}`); return i[$] ? i(n) : i.length > 1 ? (o = [e, e, '', n], T.setFilters.hasOwnProperty(e.toLowerCase()) ? r((e, t) => { for (var r, o = i(e, n), a = o.length; a--;)r = ee(e, o[a]), e[r] = !(t[r] = o[a]); }) : function (e) { return i(e, 0, o); }) : i; }, + TAG(e) { const t = e.replace(be, xe).toLowerCase(); return e === '*' ? function () { return !0; } : function (e) { return e.nodeName && e.nodeName.toLowerCase() === t; }; }, CLASS(e) { let t = U[`${e} `]; return t || (t = new RegExp(`(^|${ne})${e}(${ne}|$)`)) && U(e, e => t.test(typeof e.className === 'string' && e.className || typeof e.getAttribute !== 'undefined' && e.getAttribute('class') || '')); }, ATTR(e, n, r) { return function (o) { let i = t.attr(o, e); return i == null ? n === '!=' : !n || (i += '', n === '=' ? i === r : n === '!=' ? i !== r : n === '^=' ? r && i.indexOf(r) === 0 : n === '*=' ? r && i.indexOf(r) > -1 : n === '$=' ? r && i.slice(-r.length) === r : n === '~=' ? (` ${i.replace(ae, ' ')} `).indexOf(r) > -1 : n === '|=' && (i === r || i.slice(0, r.length + 1) === `${r}-`)); }; }, CHILD(e, t, n, r, o) { const i = e.slice(0, 3) !== 'nth'; const a = e.slice(-4) !== 'last'; const s = t === 'of-type'; return r === 1 && o === 0 ? function (e) { return !!e.parentNode; } : function (t, n, u) { let l; let c; let f; let p; let h; let d; let g = i !== a ? 'nextSibling' : 'previousSibling'; const m = t.parentNode; const v = s && t.nodeName.toLowerCase(); const y = !u && !s; let b = !1; if (m) { if (i) { for (;g;) { for (p = t; p = p[g];) if (s ? p.nodeName.toLowerCase() === v : p.nodeType === 1) return !1; d = g = e === 'only' && !d && 'nextSibling'; } return !0; } if (d = [a ? m.firstChild : m.lastChild], a && y) { for (p = m, f = p[$] || (p[$] = {}), c = f[p.uniqueID] || (f[p.uniqueID] = {}), l = c[e] || [], h = l[0] === W && l[1], b = h && l[2], p = h && m.childNodes[h]; p = ++h && p && p[g] || (b = h = 0) || d.pop();) if (p.nodeType === 1 && ++b && p === t) { c[e] = [W, h, b]; break; } } else if (y && (p = t, f = p[$] || (p[$] = {}), c = f[p.uniqueID] || (f[p.uniqueID] = {}), l = c[e] || [], h = l[0] === W && l[1], b = h), b === !1) for (;(p = ++h && p && p[g] || (b = h = 0) || d.pop()) && ((s ? p.nodeName.toLowerCase() !== v : p.nodeType !== 1) || !++b || (y && (f = p[$] || (p[$] = {}), c = f[p.uniqueID] || (f[p.uniqueID] = {}), c[e] = [W, b]), p !== t)););return b -= o, b === r || b % r === 0 && b / r >= 0; } }; }, PSEUDO(e, n) { let o; const i = T.pseudos[e] || T.setFilters[e.toLowerCase()] || t.error(`unsupported pseudo: ${e}`); return i[$] ? i(n) : i.length > 1 ? (o = [e, e, '', n], T.setFilters.hasOwnProperty(e.toLowerCase()) ? r((e, t) => { for (var r, o = i(e, n), a = o.length; a--;)r = ee(e, o[a]), e[r] = !(t[r] = o[a]); }) : function (e) { return i(e, 0, o); }) : i; }, }, pseudos: { not: r((e) => { const t = []; const n = []; const o = N(e.replace(se, '$1')); return o[$] ? r((e, t, n, r) => { for (var i, a = o(e, null, r, []), s = e.length; s--;)(i = a[s]) && (e[s] = !(t[s] = i)); }) : function (e, r, i) { return t[0] = e, o(t, null, i, n), t[0] = null, !n.pop(); }; }), @@ -73,7 +73,7 @@ }, de.extend({ Deferred(t) { const n = [['notify', 'progress', de.Callbacks('memory'), de.Callbacks('memory'), 2], ['resolve', 'done', de.Callbacks('once memory'), de.Callbacks('once memory'), 0, 'resolved'], ['reject', 'fail', de.Callbacks('once memory'), de.Callbacks('once memory'), 1, 'rejected']]; let r = 'pending'; var o = { - state() { return r; }, always() { return i.done(arguments).fail(arguments), this; }, catch(e) { return o.then(null, e); }, pipe() { let e = arguments; return de.Deferred((t) => { de.each(n, (n, r) => { let o = de.isFunction(e[r[4]]) && e[r[4]]; i[r[1]](function () { let e = o && o.apply(this, arguments); e && de.isFunction(e.promise) ? e.promise().progress(t.notify).done(t.resolve).fail(t.reject) : t[`${r[0]}With`](this, o ? [e] : arguments); }); }), e = null; }).promise(); }, then(t, r, o) { function i(t, n, r, o) { return function () { let l = this; let c = arguments; const f = function () { let e; let f; if (!(t < a)) { if (e = r.apply(l, c), e === n.promise()) throw new TypeError('Thenable self-resolution'); f = e && (typeof e == 'object' || typeof e === 'function') && e.then, de.isFunction(f) ? o ? f.call(e, i(a, n, s, o), i(a, n, u, o)) : (a++, f.call(e, i(a, n, s, o), i(a, n, u, o), i(a, n, s, n.notifyWith))) : (r !== s && (l = void 0, c = [e]), (o || n.resolveWith)(l, c)); } }; var p = o ? f : function () { try { f(); } catch (e) { de.Deferred.exceptionHook && de.Deferred.exceptionHook(e, p.stackTrace), t + 1 >= a && (r !== u && (l = void 0, c = [e]), n.rejectWith(l, c)); } }; t ? p() : (de.Deferred.getStackHook && (p.stackTrace = de.Deferred.getStackHook()), e.setTimeout(p)); }; } var a = 0; return de.Deferred((e) => { n[0][3].add(i(0, e, de.isFunction(o) ? o : s, e.notifyWith)), n[1][3].add(i(0, e, de.isFunction(t) ? t : s)), n[2][3].add(i(0, e, de.isFunction(r) ? r : u)); }).promise(); }, promise(e) { return e != null ? de.extend(e, o) : o; }, + state() { return r; }, always() { return i.done(arguments).fail(arguments), this; }, catch(e) { return o.then(null, e); }, pipe() { let e = arguments; return de.Deferred((t) => { de.each(n, (n, r) => { const o = de.isFunction(e[r[4]]) && e[r[4]]; i[r[1]](function () { const e = o && o.apply(this, arguments); e && de.isFunction(e.promise) ? e.promise().progress(t.notify).done(t.resolve).fail(t.reject) : t[`${r[0]}With`](this, o ? [e] : arguments); }); }), e = null; }).promise(); }, then(t, r, o) { function i(t, n, r, o) { return function () { let l = this; let c = arguments; const f = function () { let e; let f; if (!(t < a)) { if (e = r.apply(l, c), e === n.promise()) throw new TypeError('Thenable self-resolution'); f = e && (typeof e === 'object' || typeof e === 'function') && e.then, de.isFunction(f) ? o ? f.call(e, i(a, n, s, o), i(a, n, u, o)) : (a++, f.call(e, i(a, n, s, o), i(a, n, u, o), i(a, n, s, n.notifyWith))) : (r !== s && (l = void 0, c = [e]), (o || n.resolveWith)(l, c)); } }; var p = o ? f : function () { try { f(); } catch (e) { de.Deferred.exceptionHook && de.Deferred.exceptionHook(e, p.stackTrace), t + 1 >= a && (r !== u && (l = void 0, c = [e]), n.rejectWith(l, c)); } }; t ? p() : (de.Deferred.getStackHook && (p.stackTrace = de.Deferred.getStackHook()), e.setTimeout(p)); }; } var a = 0; return de.Deferred((e) => { n[0][3].add(i(0, e, de.isFunction(o) ? o : s, e.notifyWith)), n[1][3].add(i(0, e, de.isFunction(t) ? t : s)), n[2][3].add(i(0, e, de.isFunction(r) ? r : u)); }).promise(); }, promise(e) { return e != null ? de.extend(e, o) : o; }, }; var i = {}; return de.each(n, (e, t) => { const a = t[2]; const s = t[5]; o[t[1]] = a.add, s && a.add(() => { r = s; }, n[3 - e][2].disable, n[0][2].lock), a.add(t[3].fire), i[t[0]] = function () { return i[`${t[0]}With`](this === i ? void 0 : this, arguments), this; }, i[`${t[0]}With`] = a.fireWith; }), o.promise(i), t && t.call(i, i), i; }, when(e) { let t = arguments.length; let n = t; const r = Array(n); const o = re.call(arguments); const i = de.Deferred(); const a = function (e) { return function (n) { r[e] = this, o[e] = arguments.length > 1 ? re.call(arguments) : n, --t || i.resolveWith(r, o); }; }; if (t <= 1 && (l(e, i.done(a(n)).resolve, i.reject), i.state() === 'pending' || de.isFunction(o[n] && o[n].then))) return i.then(); for (;n--;)l(o[n], a(n), i.reject); return i.promise(); }, @@ -93,11 +93,11 @@ add(e, t, n, r, o) { let i; let a; let s; let u; let l; let c; let f; let p; let h; let d; let g; const m = Fe.get(e); if (m) { for (n.handler && (i = n, n = i.handler, o = i.selector), o && de.find.matchesSelector(Ye, o), n.guid || (n.guid = de.guid++), (u = m.events) || (u = m.events = {}), (a = m.handle) || (a = m.handle = function (t) { return typeof de !== 'undefined' && de.event.triggered !== t.type ? de.event.dispatch.apply(e, arguments) : void 0; }), t = (t || '').match(qe) || [''], l = t.length; l--;) { - s = Ze.exec(t[l]) || [], h = g = s[1], d = (s[2] || '').split('.').sort(), h && (f = de.event.special[h] || {}, h = (o ? f.delegateType : f.bindType) || h, f = de.event.special[h] || {}, c = de.extend({ - type: h, origType: g, data: r, handler: n, guid: n.guid, selector: o, needsContext: o && de.expr.match.needsContext.test(o), namespace: d.join('.'), - }, i), (p = u[h]) || (p = u[h] = [], p.delegateCount = 0, f.setup && f.setup.call(e, r, d, a) !== !1 || e.addEventListener && e.addEventListener(h, a)), f.add && (f.add.call(e, c), c.handler.guid || (c.handler.guid = n.guid)), o ? p.splice(p.delegateCount++, 0, c) : p.push(c), de.event.global[h] = !0); -} -} + s = Ze.exec(t[l]) || [], h = g = s[1], d = (s[2] || '').split('.').sort(), h && (f = de.event.special[h] || {}, h = (o ? f.delegateType : f.bindType) || h, f = de.event.special[h] || {}, c = de.extend({ + type: h, origType: g, data: r, handler: n, guid: n.guid, selector: o, needsContext: o && de.expr.match.needsContext.test(o), namespace: d.join('.'), + }, i), (p = u[h]) || (p = u[h] = [], p.delegateCount = 0, f.setup && f.setup.call(e, r, d, a) !== !1 || e.addEventListener && e.addEventListener(h, a)), f.add && (f.add.call(e, c), c.handler.guid || (c.handler.guid = n.guid)), o ? p.splice(p.delegateCount++, 0, c) : p.push(c), de.event.global[h] = !0); + } + } }, remove(e, t, n, r, o) { let i; let a; let s; let u; let l; let c; let f; let p; let h; let d; let g; const m = Fe.hasData(e) && Fe.get(e); if (m && (u = m.events)) { for (t = (t || '').match(qe) || [''], l = t.length; l--;) if (s = Ze.exec(t[l]) || [], h = g = s[1], d = (s[2] || '').split('.').sort(), h) { for (f = de.event.special[h] || {}, h = (r ? f.delegateType : f.bindType) || h, p = u[h] || [], s = s[2] && new RegExp(`(^|\\.)${d.join('\\.(?:.*\\.|)')}(\\.|$)`), a = i = p.length; i--;)c = p[i], !o && g !== c.origType || n && n.guid !== c.guid || s && !s.test(c.namespace) || r && r !== c.selector && (r !== '**' || !c.selector) || (p.splice(i, 1), c.selector && p.delegateCount--, f.remove && f.remove.call(e, c)); a && !p.length && (f.teardown && f.teardown.call(e, d, m.handle) !== !1 || de.removeEvent(e, h, m.handle), delete u[h]); } else for (h in u)de.event.remove(e, h + t[l], n, r, !0); de.isEmptyObject(u) && Fe.remove(e, 'handle events'); } }, dispatch(e) { let t; let n; let r; let o; let i; let a; const s = de.event.fix(e); const u = new Array(arguments.length); const l = (Fe.get(this, 'events') || {})[s.type] || []; const c = de.event.special[s.type] || {}; for (u[0] = s, t = 1; t < arguments.length; t++)u[t] = arguments[t]; if (s.delegateTarget = this, !c.preDispatch || c.preDispatch.call(this, s) !== !1) { for (a = de.event.handlers.call(this, s, l), t = 0; (o = a[t++]) && !s.isPropagationStopped();) for (s.currentTarget = o.elem, n = 0; (i = o.handlers[n++]) && !s.isImmediatePropagationStopped();)s.rnamespace && !s.rnamespace.test(i.namespace) || (s.handleObj = i, s.data = i.data, r = ((de.event.special[i.origType] || {}).handle || i.handler).apply(o.elem, u), void 0 !== r && (s.result = r) === !1 && (s.preventDefault(), s.stopPropagation())); return c.postDispatch && c.postDispatch.call(this, s), s.result; } }, diff --git a/package.json b/package.json index 2c364a4d..80cd17c2 100755 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "scripts": { "pretest": "npm run build && truffle compile && truffle migrate --network development", + "pre-commit": "lint-staged", "test": "./node_modules/.bin/mocha --exit ./tests/index.js --timeout 3000000 --require babel-core/register --require babel-polyfill --reporter mocha-multi-reporters", "test:truffle": "truffle test --network development ./tests/contracts/erc20TokenLock-truffle.js", "index": "babel-node ./index.js --presets es2015,stage-2", @@ -28,13 +29,9 @@ "lint:fix": "eslint ./src --fix", "ganache:start": "ganache-cli -p 8545 -q", "watch": "onchange 'src/**/*.js' -- npm run build", + "prepare": "husky install", "install": "( [ ! -d ./build ] && [ ! -f ./built ] && echo \"\" > ./built && npm install . && npm run build ) || echo \"Already built\"" }, - "pre-commit": [ - "lint:fix", - "build", - "jsdoc:build" - ], "dependencies": { "@openzeppelin/contracts": "^3.4.1", "abi-decoder": "^1.2.0", @@ -81,13 +78,14 @@ "ganache-cli": "^6.12.2", "gitbook-cli": "^2.3.2", "http-server": "^0.12.3", + "husky": "^6.0.0", "jsdoc": "^3.6.6", "jsdoc-babel": "^0.5.0", "jsdoc-md": "^8.0.0", "jsdoc-to-markdown": "^6.0.1", + "lint-staged": "^8.0.0", "mocha-multi-reporters": "^1.5.1", "onchange": "^2.4.0", - "pre-commit": "^1.2.2", "should": "^7.1.0", "supertest": "^1.0.0", "truffle": "5.1.7" @@ -105,6 +103,11 @@ "sourceMaps": true, "retainLines": true }, + "lint-staged": { + "*.{js,jsx}": [ + "eslint ./src --fix" + ] + }, "author": "", "license": "ISC" } diff --git a/truffle-config.js b/truffle-config.js index 1b84ac7a..a7668923 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -13,13 +13,13 @@ module.exports = { solc: { version: '0.6.2', // Fetch exact version from solc-bin (default: truffle's version) // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) - settings: { // See the solidity docs for advice about optimization and evmVersion + settings: { // See the solidity docs for advice about optimization and evmVersion optimizer: { enabled: true, - runs: 200 - } - //evmVersion: "byzantium" - } + runs: 200, + }, + // evmVersion: "byzantium" + }, }, }, };