10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ae1fd7 commit e308339Copy full SHA for e308339
JavaScript/6-metasync.js
@@ -6,13 +6,11 @@ const util = require('util');
6
// Production implementation from Metasync library
7
// See: https://github.com/metarhia/metasync
8
9
-const metasync = {};
10
-
11
function Memoized() {}
12
13
util.inherits(Memoized, Function);
14
15
-metasync.memoize = (fn) => {
+const memoize = fn => {
16
const cache = new Map();
17
18
const memoized = function(...args) {
@@ -47,7 +45,7 @@ Memoized.prototype.clear = function() {
47
45
48
46
// Usage
49
50
-fs.readFile = metasync.memoize(fs.readFile);
+fs.readFile = memoize(fs.readFile);
51
52
fs.readFile('6-metasync.js', 'utf8', (err, data) => {
53
console.log('data length: ' + data.length);
0 commit comments