mirror of https://github.com/nodejs/node.git
repl: do not insert duplicates into completions
Fix invalid `hasOwnProperty` function usage. For example, before in the REPL: ``` > Ar<Tab> Array Array ArrayBuffer ``` Now: ``` > Ar<Tab> Array ArrayBuffer ``` Fixes #6255. Closes #6498.pull/24998/head
parent
2010985354
commit
568072ceae
|
@ -641,7 +641,7 @@ REPLServer.prototype.complete = function(line, callback) {
|
|||
group.sort();
|
||||
for (var j = 0; j < group.length; j++) {
|
||||
c = group[j];
|
||||
if (!hasOwnProperty(c)) {
|
||||
if (!hasOwnProperty(uniq, c)) {
|
||||
completions.push(c);
|
||||
uniq[c] = true;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ putIn.run([
|
|||
testMe.complete('inner.o', function(error, data) {
|
||||
assert.deepEqual(data, doesNotBreak);
|
||||
});
|
||||
testMe.complete('console.lo', function(error, data) {
|
||||
assert.deepEqual(data, [['console.log'], 'console.lo']);
|
||||
});
|
||||
|
||||
// Tab Complete will return globaly scoped variables
|
||||
putIn.run(['};']);
|
||||
|
|
Loading…
Reference in New Issue