Skip to content

Commit 3a33259

Browse files
committed
Use const instead of let
1 parent e8dce3b commit 3a33259

File tree

6 files changed

+171
-10
lines changed

6 files changed

+171
-10
lines changed

.eslintrc.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
parserOptions:
2+
ecmaVersion: 6
3+
env:
4+
node: true
5+
extends: 'eslint:recommended'
6+
globals:
7+
rules:
8+
indent:
9+
- error
10+
- 2
11+
- SwitchCase: 1
12+
VariableDeclarator:
13+
var: 2
14+
let: 2
15+
const: 3
16+
MemberExpression: 1
17+
linebreak-style:
18+
- error
19+
- unix
20+
quotes:
21+
- error
22+
- single
23+
semi:
24+
- error
25+
- always
26+
eqeqeq:
27+
- error
28+
- always
29+
no-loop-func:
30+
- error
31+
strict:
32+
- error
33+
- global
34+
block-spacing:
35+
- error
36+
- always
37+
brace-style:
38+
- error
39+
- 1tbs
40+
- allowSingleLine: true
41+
camelcase:
42+
- error
43+
comma-style:
44+
- error
45+
- last
46+
comma-spacing:
47+
- error
48+
- before: false
49+
after: true
50+
eol-last:
51+
- error
52+
func-call-spacing:
53+
- error
54+
- never
55+
key-spacing:
56+
- error
57+
- beforeColon: false
58+
afterColon: true
59+
mode: minimum
60+
keyword-spacing:
61+
- error
62+
- before: true
63+
after: true
64+
overrides:
65+
function:
66+
after: false
67+
max-len:
68+
- error
69+
- code: 80
70+
ignoreUrls: true
71+
max-nested-callbacks:
72+
- error
73+
- max: 5
74+
new-cap:
75+
- error
76+
- newIsCap: true
77+
capIsNew: true
78+
properties: true
79+
new-parens:
80+
- error
81+
no-lonely-if:
82+
- error
83+
no-trailing-spaces:
84+
- error
85+
no-unneeded-ternary:
86+
- error
87+
no-whitespace-before-property:
88+
- error
89+
object-curly-spacing:
90+
- error
91+
- always
92+
operator-assignment:
93+
- error
94+
- always
95+
operator-linebreak:
96+
- error
97+
- after
98+
semi-spacing:
99+
- error
100+
- before: false
101+
after: true
102+
space-before-blocks:
103+
- error
104+
- always
105+
space-before-function-paren:
106+
- error
107+
- never
108+
space-in-parens:
109+
- error
110+
- never
111+
space-infix-ops:
112+
- error
113+
space-unary-ops:
114+
- error
115+
- words: true
116+
nonwords: false
117+
overrides:
118+
typeof: false
119+
no-unreachable:
120+
- error
121+
no-global-assign:
122+
- error
123+
no-self-compare:
124+
- error
125+
no-unmodified-loop-condition:
126+
- error
127+
no-constant-condition:
128+
- error
129+
- checkLoops: false
130+
no-console:
131+
- off
132+
no-useless-concat:
133+
- error
134+
no-useless-escape:
135+
- error
136+
no-shadow-restricted-names:
137+
- error
138+
no-use-before-define:
139+
- error
140+
- functions: false

.jshintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"esversion": 6,
3+
"node": true
4+
}

JavaScript/1-closure.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
let log = function(base, n) {
3+
const log = function(base, n) {
44
return Math.log(n) / Math.log(base);
55
};
66

77
function createLog(base) {
8-
return function (n) {
8+
return function(n) {
99
return log(base, n);
1010
};
1111
}
1212

13-
let lg = createLog(10);
14-
let ln = createLog(Math.E);
13+
const lg = createLog(10);
14+
const ln = createLog(Math.E);

JavaScript/2-lambda.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
let log = function(base, n) {
3+
const log = function(base, n) {
44
return Math.log(n) / Math.log(base);
55
};
66

7-
let lg = n => log(10, n);
8-
let ln = n => log(Math.E, n);
7+
const lg = n => log(10, n);
8+
const ln = n => log(Math.E, n);

JavaScript/3-bind.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
let log = function(base, n) {
3+
const log = function(base, n) {
44
return Math.log(n) / Math.log(base);
55
};
66

7-
let lg = log.bind(null, 10);
8-
let ln = log.bind(null, Math.E);
7+
const lg = log.bind(null, 10);
8+
const ln = log.bind(null, Math.E);

JavaScript/4-curry.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
const sum3 = function(a, b, c) {
4+
return a + b + c;
5+
};
6+
7+
function curry(fn, x) {
8+
return function(...args) {
9+
args.push(x);
10+
return fn(...args);
11+
};
12+
}
13+
14+
const f1 = curry(sum3, 10);
15+
const f2 = curry(f1, 5);
16+
const y = f2(1);
17+
console.log(y);

0 commit comments

Comments
 (0)