Skip to content

Commit fa0b185

Browse files
committed
Add node: for internal modules
1 parent cf1f874 commit fa0b185

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

JavaScript/1-imperative-bad.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// 4. Unclear naming (or extra short) or no naming (array indexes)
88
// 5. Long expressions
99

10-
const fs = require('fs');
10+
const fs = require('node:fs');
1111

1212
const data = fs.readFileSync('./cities.csv', 'utf8');
1313
if (data) {

JavaScript/2-imperative-good.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// 6. Mutable data structures
99
// 7. Model of the process
1010

11-
const fs = require('fs');
11+
const fs = require('node:fs');
1212

1313
const loadFile = (fileName) => {
1414
try {

JavaScript/3-functional-bad.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// 7. Return hack
1111
// 8. Magic numbers
1212

13-
const fs = require('fs');
13+
const fs = require('node:fs');
1414

1515
const rpad = (s, count, char) => s.padEnd(count, char);
1616
const lpad = (s, count, char) => s.padStart(count, char);

JavaScript/4-functional-good.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// 6. No variables, no side effects
1010
// 7. Math model
1111

12-
const fs = require('fs');
12+
const fs = require('node:fs');
1313

1414
const proportion = (max, val) => Math.round(val * 100 / max);
1515
const compose = (...funcs) => (x) => funcs.reduce((x, fn) => fn(x), x);

JavaScript/5-functional-alternative.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const fs = require('fs');
3+
const fs = require('node:fs');
44

55
const proportion = (max, val) => Math.round(val * 100 / max);
66

JavaScript/6-functional-pure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const fs = require('fs');
3+
const fs = require('node:fs');
44

55
/* fp */
66
const pipe = (...fns) => (x) => fns.reduce((v, f) => f(v), x);

JavaScript/7-mixed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const fs = require('fs');
3+
const fs = require('node:fs');
44

55
const compose = (...funcs) => (x) => funcs.reduce((x, fn) => fn(x), x);
66

0 commit comments

Comments
 (0)