10000 Improve code style · HowProgrammingWorks/Memoization@e308339 · GitHub
[go: up one dir, main page]

Skip to content

Commit e308339

Browse files
committed
Improve code style
1 parent 4ae1fd7 commit e308339

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

JavaScript/6-metasync.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ const util = require('util');
66
// Production implementation from Metasync library
77
// See: https://github.com/metarhia/metasync
88

9-
const metasync = {};
10-
119
function Memoized() {}
1210

1311
util.inherits(Memoized, Function);
1412

15-
metasync.memoize = (fn) => {
13+
const memoize = fn => {
1614
const cache = new Map();
1715

1816
const memoized = function(...args) {
@@ -47,7 +45,7 @@ Memoized.prototype.clear = function() {
4745

4846
// Usage
4947

50-
fs.readFile = metasync.memoize(fs.readFile);
48+
fs.readFile = memoize(fs.readFile);
5149

5250
fs.readFile('6-metasync.js', 'utf8', (err, data) => {
5351
console.log('data length: ' + data.length);

0 commit comments

Comments
 (0)
0