Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed Nov 17, 2018
1 parent 72363bb commit 603b3f3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
31 changes: 14 additions & 17 deletions src/partial.lenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,8 @@ const subseqU = function subseq(begin, end, t) {
t = toFunction(t)
return copyName((x, i, F, xi2yF) => {
let n = -1
return t(
x,
i,
F,
(x, i) => (begin <= ++n && !(end <= n) ? xi2yF(x, i) : F.of(x))
return t(x, i, F, (x, i) =>
begin <= ++n && !(end <= n) ? xi2yF(x, i) : F.of(x)
)
}, t)
}
Expand Down Expand Up @@ -940,8 +937,8 @@ const elemsI = (xs, _i, A, xi2yA) =>
A === I.Identity
? mapPartialIndexU(xi2yA, xs, void 0)
: A === Select
? selectInArrayLike(xi2yA, xs)
: traversePartialIndex(A, xi2yA, xs, void 0)
? selectInArrayLike(xi2yA, xs)
: traversePartialIndex(A, xi2yA, xs, void 0)

//

Expand Down Expand Up @@ -1648,8 +1645,8 @@ export const elemsTotal = (xs, i, A, xi2yA) =>
? A === I.Identity
? mapPartialIndexU(xi2yA, xs, mapPartialIndexU)
: A === Select
? selectInArrayLike(xi2yA, xs)
: traversePartialIndex(A, xi2yA, xs, traversePartialIndex)
? selectInArrayLike(xi2yA, xs)
: traversePartialIndex(A, xi2yA, xs, traversePartialIndex)
: A.of(xs)

export const entries = setName(toFunction([keyed, elems]), 'entries')
Expand All @@ -1663,8 +1660,8 @@ export const keysEverywhere = (x, i, A, xi2yA) => {
I.isArray(x)
? elemsI(x, i, A, recAny)
: I.isObject(x)
? entries(x, i, A, recEntry)
: A.of(x)
? entries(x, i, A, recEntry)
: A.of(x)
return recAny(x, i)
}

Expand Down Expand Up @@ -1709,8 +1706,8 @@ export function children(x, i, C, xi2yC) {
return I.isArray(x)
? elemsI(x, i, C, xi2yC)
: I.isObject(x)
? values(x, i, C, xi2yC)
: C.of(x)
? values(x, i, C, xi2yC)
: C.of(x)
}

export function flatten(x, i, C, xi2yC) {
Expand Down Expand Up @@ -1909,8 +1906,8 @@ export const joinAs = mkTraverse(
0,
C.ef(reqString('`join` and `joinAs` expect a string delimiter'))
))(function joinAs(d) {
return ConstantWith(
(x, y) => (void 0 !== x ? (void 0 !== y ? x + d + y : x) : y)
return ConstantWith((x, y) =>
void 0 !== x ? (void 0 !== y ? x + d + y : x) : y
)
})
)
Expand Down Expand Up @@ -2601,8 +2598,8 @@ export const pointer = s => {
ts[i - 1] = /^(0|[1-9]\d*)$/.test(t)
? ifElse(isArrayOrPrimitive, Number(t), t)
: '-' === t
? ifElse(isArrayOrPrimitive, append, t)
: t.replace('~1', '/').replace('~0', '~')
? ifElse(isArrayOrPrimitive, append, t)
: t.replace('~1', '/').replace('~0', '~')
}
ts[I.LENGTH] = n - 1
return ts
Expand Down
23 changes: 12 additions & 11 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ const everywhere = [
L.lazy(rec => {
const elems = L.seq([L.elems, rec], L.identity)
const values = L.seq([L.values, rec], L.identity)
return L.choose(
x =>
x instanceof Array ? elems : x instanceof Object ? values : L.identity
return L.choose(x =>
x instanceof Array ? elems : x instanceof Object ? values : L.identity
)
})
]
Expand Down Expand Up @@ -765,14 +764,16 @@ describe('L.filter', () => {
testEq(() => L.set(L.filter(R.lt(0)), [], [3, 1, 4, 1, 5, 9, 2]), [])
testEq(() => L.remove(L.filter(R.lt(0)), [3, 1, 4, 1, 5, 9, 2]), [])
testEq(() => L.remove(L.filter(R.lt(2)), [3, 1, 4, 1, 5, 9, 2]), [1, 1, 2])
empties.filter(x => !I.isArray(x) && !I.isString(x)).forEach(invalid => {
testEq(() => L.get(L.filter(I.always(true)), invalid), undefined)
testEq(() => L.set(L.filter(I.always(true)), [1, '2', 3], invalid), [
1,
'2',
3
])
})
empties
.filter(x => !I.isArray(x) && !I.isString(x))
.forEach(invalid => {
testEq(() => L.get(L.filter(I.always(true)), invalid), undefined)
testEq(() => L.set(L.filter(I.always(true)), [1, '2', 3], invalid), [
1,
'2',
3
])
})
testEq(() => L.remove(L.filter(c => 'a' <= c), 'JavaScript'), ['J', 'S'])
})

Expand Down

0 comments on commit 603b3f3

Please sign in to comment.