remove some duplicated code

This commit is contained in:
ansuz 2020-02-14 16:45:53 -05:00
parent d274be6de4
commit 3f606d8c75
4 changed files with 3 additions and 21 deletions

View File

@ -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;
};

View File

@ -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;

View File

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

View File

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