Navigation Menu

Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Commit

Permalink
fix up docs bug + clean up regex for color matching
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed May 16, 2011
1 parent 62b9126 commit 77b14f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/ender.docs.js
Expand Up @@ -44,8 +44,8 @@ var UTIL = require('./ender.util')
' + example: ' + '$ ender info -u ../public/js/mootools.js\n\n'.cyan,

search: '- search:\n'.yellow +
' + searches NPM registry for provided keywords -- bubbles up ender compatible modules'
' + example: ' + '$ ender search bean\n'.cyan +
' + searches NPM registry for provided keywords -- bubbles up ender compatible modules' +
' + example: ' + '$ ender search bean\n'.cyan,

compile: '- compile:\n'.yellow +
' + Allows you to compile your application along-side your ender installation using the Google Closure Compiler\n' +
Expand Down Expand Up @@ -75,7 +75,7 @@ var UTIL = require('./ender.util')
' + example: ' + '$ ender info\n'.cyan +

'- search:\n'.yellow +
' + searches NPM registry for provided keywords -- bubbles up ender compatible modules'
' + searches NPM registry for provided keywords -- bubbles up ender compatible modules' +
' + example: ' + '$ ender search bean\n'.cyan +

'- compile:\n'.yellow +
Expand Down
4 changes: 2 additions & 2 deletions lib/ender.search.js
Expand Up @@ -55,7 +55,7 @@ function rankRelevance(terms, array) {
matchAgainstReg(regex, array, ranked, ['name']);

//whole query match against priorities as words
var regex = new RegExp('\\b' + escapeRegExp(terms.join('\\s')) + '\\b', 'i');
var regex = new RegExp('\\b' + escapeRegExp(terms.join('\s')) + '\\b', 'i');
matchAgainstReg(regex, array, ranked, priority);

//any one query against priorities as word
Expand Down Expand Up @@ -87,7 +87,7 @@ function matchAgainstReg(regex, array, ranked, priority) {
}

function processItem(item, terms) {
var reg = new RegExp('(' + escapeRegExp(terms.join('|')) + ')', 'ig');
var reg = new RegExp('(' + terms.map(function (item) { return escapeRegExp(item) }).join('|') + ')', 'ig');

var title = item.name, dots = item.description.length > 80 ? '...' : '';
if (item.description) title += ' - ' + item.description.substring(0, 80) + dots;
Expand Down

0 comments on commit 77b14f8

Please sign in to comment.