Skip to content

Commit 7bd3a1c

Browse files
committed
Update all files to conform to standard style
1 parent e0da0ce commit 7bd3a1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+723
-730
lines changed

example/sqrt.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @license ISC
99
*/
1010

11-
import * as lazy from '../source';
11+
import * as lazy from '../source'
1212

1313
/**
1414
* Compute the square root of a number using infinite lists with the Newton-Raphson method.
@@ -23,18 +23,20 @@ import * as lazy from '../source';
2323
* sqrt(1,0,144); // => 12
2424
* relativeSqrt(1,0,144); // optimized version for very small and very large numbers
2525
*/
26-
const sqrt = (a01, eps0, n) => within(eps, lazy.iterate(next.bind(null, n), a0));
26+
export const sqrt = (a0, eps, n) => within(eps, lazy.iterate(next.bind(null, n), a0))
2727

28-
const relativeSqrt = (a0, eps, n) => relative(eps, lazy.iterate(next.bind(null, n), a0));
28+
export const relativeSqrt = (a0, eps, n) => relative(eps, lazy.iterate(next.bind(null, n), a0))
2929

30-
const next = (n, x) => (x + n/x) / 2;
30+
const next = (n, x) => (x + n / x) / 2
3131

3232
const within = (eps, rest) => {
33-
let a = lazy.index(rest, 0), b = lazy.index(rest, 1);
34-
return Math.abs(a - b) <= eps ? b : within(eps, lazy.drop(1, rest));
33+
let a = lazy.index(rest, 0)
34+
let b = lazy.index(rest, 1)
35+
return Math.abs(a - b) <= eps ? b : within(eps, lazy.drop(1, rest))
3536
}
3637

3738
const relative = (eps, rest) => {
38-
let a = lazy.index(rest, 0), b = lazy.index(rest, 1);
39-
return Math.abs(a - b) <= eps * Math.abs(b) ? b : relative(eps, lazy.drop(1, rest));
39+
let a = lazy.index(rest, 0)
40+
let b = lazy.index(rest, 1)
41+
return Math.abs(a - b) <= eps * Math.abs(b) ? b : relative(eps, lazy.drop(1, rest))
4042
}

source/error.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
*/
1010

1111
export class EmptyListError extends Error {
12-
constructor(message) {
13-
super(message);
14-
this.name = 'EmptyListError';
12+
constructor (message) {
13+
super(message)
14+
this.name = 'EmptyListError'
1515
}
1616
}
1717
export class OutOfRangeError extends Error {
18-
constructor(message) {
19-
super(message);
20-
this.name = 'OutOfRangeError';
18+
constructor (message) {
19+
super(message)
20+
this.name = 'OutOfRangeError'
2121
}
2222
}

source/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export {
1111
LT,
1212
GT,
1313
EQ
14-
} from './ord';
14+
} from './ord'
1515

1616
export {
1717
emptyList,
@@ -48,9 +48,9 @@ export {
4848
repeat,
4949
replicate,
5050
cycle
51-
} from './lib';
51+
} from './lib'
5252

5353
export {
5454
EmptyListError,
5555
OutOfRangeError
56-
} from './error';
56+
} from './error'

0 commit comments

Comments
 (0)