remove some duplicated code

pull/1/head
ansuz 5 years ago
parent d274be6de4
commit 3f606d8c75

@ -1,11 +0,0 @@
// remove duplicate elements in an array
module.exports = function (O) {
// make a copy of the original array
var A = O.slice();
for (var i = 0; i < A.length; i++) {
for (var j = i + 1; j < A.length; j++) {
if (A[i] === A[j]) { A.splice(j--, 1); }
}
}
return A;
};

@ -3,7 +3,7 @@
var HK = module.exports;
const nThen = require('nthen');
const Once = require("./once");
const Util = require("./common-util");
const Meta = require("./metadata");
const Nacl = require('tweetnacl/nacl-fast');
@ -182,7 +182,7 @@ const computeIndex = function (Env, channelName, cb) {
const ref = {};
const CB = Once(cb);
const CB = Util.once(cb);
const offsetByHash = {};
let size = 0;

@ -1,6 +1,6 @@
var Meta = module.exports;
var deduplicate = require("./deduplicate");
var deduplicate = require("./common-util").deduplicateString;
/* Metadata fields:

@ -1,7 +0,0 @@
module.exports = function (f, g) {
return function () {
if (!f) { return; }
f.apply(this, Array.prototype.slice.call(arguments));
f = g;
};
};
Loading…
Cancel
Save