From 71d5e5f15081fa7fd240049539af616a926d7b2d Mon Sep 17 00:00:00 2001 From: Bren Norris Date: Sun, 9 Apr 2017 10:05:31 -0400 Subject: [PATCH] search now accepts a tilda to list all contents of the local package list --- lib/search.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/search.js b/lib/search.js index 27d46b1bd..b21fd0dcb 100644 --- a/lib/search.js +++ b/lib/search.js @@ -12,7 +12,9 @@ function Search() { } Search.prototype.query = function(q) { - return this.index.search(q) + return q === '~' + ? this.storage.config.localList.get().map( function( package ){ return { ref: package, score: 1 }; } ) + : this.index.search(q); } Search.prototype.add = function(package) { @@ -45,4 +47,3 @@ Search.prototype.configureStorage = function(storage) { } module.exports = Search() -