From 995d1315ef914bd28aa704d1a86f33c34d0a40b1 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Thu, 27 Apr 2017 11:22:20 -0700 Subject: [PATCH] Indent member expressions A rule to this effect is coming in JavaScript Standard Style: https://github.com/feross/standard/issues/628 --- index.js | 8 +- models/form.js | 2 +- proxy.js | 82 +++++++++---------- server.js | 46 +++++------ test/comparison.test.js | 104 ++++++++++++------------ test/display.test.js | 18 ++--- test/edit.test.js | 38 ++++----- test/load-forms.test.js | 148 +++++++++++++++++------------------ test/post-form.js | 2 +- test/post-project.js | 16 ++-- test/signature-pages.test.js | 74 +++++++++--------- test/typography.test.js | 32 ++++---- test/webdriver.js | 8 +- utilities/annotate.js | 10 +-- utilities/replace-unicode.js | 4 +- views/projects.js | 14 ++-- views/search.js | 4 +- 17 files changed, 306 insertions(+), 304 deletions(-) diff --git a/index.js b/index.js index 0b3fabff..0682d552 100644 --- a/index.js +++ b/index.js @@ -224,10 +224,10 @@ window.addEventListener('popstate', update) // Copy Links new Clipboard('.copy') -.on('success', function (event) { - window.alert('Copied') - event.clearSelection() -}) + .on('success', function (event) { + window.alert('Copied') + event.clearSelection() + }) if (module.parent) { module.exports = render diff --git a/models/form.js b/models/form.js index 9939706c..895edc81 100644 --- a/models/form.js +++ b/models/form.js @@ -535,7 +535,7 @@ module.exports = function (initialize, reduction, handler) { } filesaver( docx(clone(state.tree), state.blanks, options) - .generate({type: 'blob'}), + .generate({type: 'blob'}), fileName(title, 'docx'), true ) diff --git a/proxy.js b/proxy.js index 7a3b7775..c193289e 100644 --- a/proxy.js +++ b/proxy.js @@ -7,46 +7,46 @@ var httpProxy = require('http-proxy') var proxy = httpProxy.createProxyServer({}) http -.createServer(corsify(function (request, response) { - var newHeaders = [ - ['Pragma', 'no-cache'], - ['Expires', '0'], - ['Cache-Control', 'no-cache, no-store, must-revalidate'], - ['Access-Control-Allow-Origin', 'http://localhost:8000'], - ['Access-Control-Allow-Credentials', 'true'], - [ - 'Access-Control-Allow-Headers', [ - 'Cache-Control', - 'Content-Type', - 'DNT', - 'If-Modified-Since', - 'Keep-Alive', - 'User-Agent', - 'X-CustomHeader', - 'X-Requested-With' - ].join(', ') - ], - ['Access-Control-Allow-Methods', http.METHODS.join(', ')], - [ - 'Access-Control-Expose-Headers', [ - 'Content-Type', - 'Location' - ].join() + .createServer(corsify(function (request, response) { + var newHeaders = [ + ['Pragma', 'no-cache'], + ['Expires', '0'], + ['Cache-Control', 'no-cache, no-store, must-revalidate'], + ['Access-Control-Allow-Origin', 'http://localhost:8000'], + ['Access-Control-Allow-Credentials', 'true'], + [ + 'Access-Control-Allow-Headers', [ + 'Cache-Control', + 'Content-Type', + 'DNT', + 'If-Modified-Since', + 'Keep-Alive', + 'User-Agent', + 'X-CustomHeader', + 'X-Requested-With' + ].join(', ') + ], + ['Access-Control-Allow-Methods', http.METHODS.join(', ')], + [ + 'Access-Control-Expose-Headers', [ + 'Content-Type', + 'Location' + ].join() + ] ] - ] - var oldWriteHead = response.writeHead - response.writeHead = function (code, headers) { - newHeaders.forEach(function (newHeader) { - response.setHeader(newHeader[0], newHeader[1]) - if (headers && headers[newHeader[0]]) { - delete headers[newHeader[0]] - } + var oldWriteHead = response.writeHead + response.writeHead = function (code, headers) { + newHeaders.forEach(function (newHeader) { + response.setHeader(newHeader[0], newHeader[1]) + if (headers && headers[newHeader[0]]) { + delete headers[newHeader[0]] + } + }) + oldWriteHead.apply(response, arguments) + } + proxy.web(request, response, { + target: process.env.TARGET || 'http://localhost:8081', + secure: false }) - oldWriteHead.apply(response, arguments) - } - proxy.web(request, response, { - target: process.env.TARGET || 'http://localhost:8081', - secure: false - }) -})) -.listen(process.env.PORT || 8080) + })) + .listen(process.env.PORT || 8080) diff --git a/server.js b/server.js index 8824387d..6381b8f3 100644 --- a/server.js +++ b/server.js @@ -13,29 +13,29 @@ var ecstatic = require('ecstatic')({ function serveIndex (response) { response.setHeader('Content-Type', 'text/html') fs.createReadStream('build/index.html') - .pipe(replace(/RELEASE\//g, release)) - .pipe(response) + .pipe(replace(/RELEASE\//g, release)) + .pipe(response) } http -.createServer(function (request, response) { - response.setHeader( - 'Cache-Control', 'no-cache, no-store, must-revalidate' - ) - response.setHeader('Pragma', 'no-cache') - response.setHeader('Expires', '0') - var pathname = url.parse(request.url).pathname - if (pathname === '/') { - serveIndex(response) - } else if ( - pathname.startsWith('/forms/') || - pathname.startsWith('/publications/') || - pathname.startsWith('/publishers') || - pathname.startsWith('/search') - ) { - serveIndex(response) - } else { - ecstatic(request, response) - } -}) -.listen(8000) + .createServer(function (request, response) { + response.setHeader( + 'Cache-Control', 'no-cache, no-store, must-revalidate' + ) + response.setHeader('Pragma', 'no-cache') + response.setHeader('Expires', '0') + var pathname = url.parse(request.url).pathname + if (pathname === '/') { + serveIndex(response) + } else if ( + pathname.startsWith('/forms/') || + pathname.startsWith('/publications/') || + pathname.startsWith('/publishers') || + pathname.startsWith('/search') + ) { + serveIndex(response) + } else { + ecstatic(request, response) + } + }) + .listen(8000) diff --git a/test/comparison.test.js b/test/comparison.test.js index a6a48d3c..ca0f1f90 100644 --- a/test/comparison.test.js +++ b/test/comparison.test.js @@ -15,27 +15,27 @@ tape.skip('Comparison', function (suite) { suite.test(function (test) { test.plan(1) webdriver - .url('http://localhost:8000/forms/' + apache2 + '/' + edited) - .isExisting('//*[contains(text(),"compared to")]') - .then(function (existing) { - test.assert( - existing, - 'Displays "compared to" when diffing.' - ) - }) + .url('http://localhost:8000/forms/' + apache2 + '/' + edited) + .isExisting('//*[contains(text(),"compared to")]') + .then(function (existing) { + test.assert( + existing, + 'Displays "compared to" when diffing.' + ) + }) }) suite.test(function (test) { test.plan(1) webdriver - .url('http://localhost:8000/forms/' + apache2 + '/' + edited) - .isExisting('//del//span[contains(text(),"whether")]') - .then(function (existing) { - test.assert( - existing, - 'Displays "whether" as a deletion.' - ) - }) + .url('http://localhost:8000/forms/' + apache2 + '/' + edited) + .isExisting('//del//span[contains(text(),"whether")]') + .then(function (existing) { + test.assert( + existing, + 'Displays "whether" as a deletion.' + ) + }) }) var abc = ( @@ -51,29 +51,29 @@ tape.skip('Comparison', function (suite) { suite.test(function (test) { test.plan(1) webdriver - .url('http://localhost:8000/forms/' + abc + '/' + bcd) - .waitForExist('//del//p[contains(text(),"This is A.")]') - .isExisting('//del//p[contains(text(),"This is A.")]') - .then(function (existing) { - test.assert( - existing, - 'Displays This is A." as a deletion.' - ) - }) + .url('http://localhost:8000/forms/' + abc + '/' + bcd) + .waitForExist('//del//p[contains(text(),"This is A.")]') + .isExisting('//del//p[contains(text(),"This is A.")]') + .then(function (existing) { + test.assert( + existing, + 'Displays This is A." as a deletion.' + ) + }) }) suite.test(function (test) { test.plan(1) webdriver - .url('http://localhost:8000/forms/' + abc + '/' + bcd) - .waitForExist('//ins//p[contains(text(),"This is D.")]') - .isExisting('//ins//p[contains(text(),"This is D.")]') - .then(function (existing) { - test.assert( - existing, - 'Displays "This is D." as an insertion.' - ) - }) + .url('http://localhost:8000/forms/' + abc + '/' + bcd) + .waitForExist('//ins//p[contains(text(),"This is D.")]') + .isExisting('//ins//p[contains(text(),"This is D.")]') + .then(function (existing) { + test.assert( + existing, + 'Displays "This is D." as an insertion.' + ) + }) }) var a = ( @@ -89,28 +89,28 @@ tape.skip('Comparison', function (suite) { suite.test(function (test) { test.plan(1) webdriver - .url('http://localhost:8000/forms/' + a + '/' + aConspicuous) - .waitForExist('//*[contains(text(),"Made conspicuous")]') - .isExisting('//*[contains(text(),"Made conspicuous")]') - .then(function (existing) { - test.assert( - existing, - 'Displays "Made conspicuous".' - ) - }) + .url('http://localhost:8000/forms/' + a + '/' + aConspicuous) + .waitForExist('//*[contains(text(),"Made conspicuous")]') + .isExisting('//*[contains(text(),"Made conspicuous")]') + .then(function (existing) { + test.assert( + existing, + 'Displays "Made conspicuous".' + ) + }) }) suite.test(function (test) { test.plan(1) webdriver - .url('http://localhost:8000/forms/' + aConspicuous + '/' + a) - .waitForExist('//*[contains(text(),"Made inconspicuous")]') - .isExisting('//*[contains(text(),"Made inconspicuous")]') - .then(function (existing) { - test.assert( - existing, - 'Displays "Made inconspicuous".' - ) - }) + .url('http://localhost:8000/forms/' + aConspicuous + '/' + a) + .waitForExist('//*[contains(text(),"Made inconspicuous")]') + .isExisting('//*[contains(text(),"Made inconspicuous")]') + .then(function (existing) { + test.assert( + existing, + 'Displays "Made inconspicuous".' + ) + }) }) }) diff --git a/test/display.test.js b/test/display.test.js index df172801..e5a7401a 100644 --- a/test/display.test.js +++ b/test/display.test.js @@ -5,14 +5,14 @@ tape('Display', function (test) { test.test('Sanity Check', function (test) { test.plan(1) webdriver - .url('http://localhost:8000') - .getText('a.openSource') - .then(function (value) { - test.equal( - value, - 'Common Form is open-source software.', - 'a.openSource says "Common Form is open-source software."' - ) - }) + .url('http://localhost:8000') + .getText('a.openSource') + .then(function (value) { + test.equal( + value, + 'Common Form is open-source software.', + 'a.openSource says "Common Form is open-source software."' + ) + }) }) }) diff --git a/test/edit.test.js b/test/edit.test.js index 51957c9a..6e8a9b83 100644 --- a/test/edit.test.js +++ b/test/edit.test.js @@ -34,25 +34,25 @@ tape('Edits', function (suite) { test.ifError(error) var firstHeading = '(//input[@class="heading"])[1]' webdriver - .url(testURL) - .waitForExist(firstHeading) - // Select the only heading. - .click(firstHeading) - // Backspace the current heading. - .keys('\uE003'.repeat(20)) - // Type a new one. - .keys('Edited') - // Hit Enter. - .keys('\uE006') - .waitForText('.digest', merkleize(after).digest) - .getUrl() - .then(function (url) { - test.equal( - url, - 'http://localhost:8000/forms/' + merkleize(after).digest, - 'updates location bar' - ) - }) + .url(testURL) + .waitForExist(firstHeading) + // Select the only heading. + .click(firstHeading) + // Backspace the current heading. + .keys('\uE003'.repeat(20)) + // Type a new one. + .keys('Edited') + // Hit Enter. + .keys('\uE006') + .waitForText('.digest', merkleize(after).digest) + .getUrl() + .then(function (url) { + test.equal( + url, + 'http://localhost:8000/forms/' + merkleize(after).digest, + 'updates location bar' + ) + }) }) }) }) diff --git a/test/load-forms.test.js b/test/load-forms.test.js index 0c460202..6d63380f 100644 --- a/test/load-forms.test.js +++ b/test/load-forms.test.js @@ -16,18 +16,18 @@ tape('Loading from API', function (suite) { postForm(form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/forms/' + digest) - .waitForExist( - '//*[contains(text(),"This is a test form.")]', - 2000 - ) - .isExisting('//*[contains(text(),"This is a test form.")]') - .then(function (existing) { - test.assert( - existing, - 'Page displays form from API.' + .url('http://localhost:8000/forms/' + digest) + .waitForExist( + '//*[contains(text(),"This is a test form.")]', + 2000 ) - }) + .isExisting('//*[contains(text(),"This is a test form.")]') + .then(function (existing) { + test.assert( + existing, + 'Page displays form from API.' + ) + }) }) }) @@ -36,18 +36,18 @@ tape('Loading from API', function (suite) { postProject('test', 'test', '1e', form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/publications/test/test') - .waitForExist( - '//*[contains(text(),"This is a test form.")]', - 2000 - ) - .isExisting('//*[contains(text(),"This is a test form.")]') - .then(function (existing) { - test.assert( - existing, - 'Page displays form from API.' + .url('http://localhost:8000/publications/test/test') + .waitForExist( + '//*[contains(text(),"This is a test form.")]', + 2000 ) - }) + .isExisting('//*[contains(text(),"This is a test form.")]') + .then(function (existing) { + test.assert( + existing, + 'Page displays form from API.' + ) + }) }) }) @@ -56,15 +56,15 @@ tape('Loading from API', function (suite) { postProject('test', 'test', '1e', form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/publications/test/test/1e') - .waitForExist('//*[contains(text(),"test")]', 2000) - .isExisting('//*[contains(text(),"test")]') - .then(function (existing) { - test.assert( - existing, - 'Page displays project name.' - ) - }) + .url('http://localhost:8000/publications/test/test/1e') + .waitForExist('//*[contains(text(),"test")]', 2000) + .isExisting('//*[contains(text(),"test")]') + .then(function (existing) { + test.assert( + existing, + 'Page displays project name.' + ) + }) }) }) @@ -73,20 +73,20 @@ tape('Loading from API', function (suite) { postProject('test', 'test', '1e', form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/publications/test/test/1e') - .waitForExist('//abbr[contains(text(), "1e")]', 2000) - .isExisting( - '//abbr[' + - 'contains(@title,"first edition") and ' + - 'contains(text(), "1e")' + - ']' - ) - .then(function (existing) { - test.assert( - existing, - 'Page displays project name.' + .url('http://localhost:8000/publications/test/test/1e') + .waitForExist('//abbr[contains(text(), "1e")]', 2000) + .isExisting( + '//abbr[' + + 'contains(@title,"first edition") and ' + + 'contains(text(), "1e")' + + ']' ) - }) + .then(function (existing) { + test.assert( + existing, + 'Page displays project name.' + ) + }) }) }) @@ -95,17 +95,17 @@ tape('Loading from API', function (suite) { postProject('test', 'test', '1e', form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/publications/test/test/latest') - .waitForExist( - '//*[contains(text(),"This is a test form.")]', 2000 - ) - .isExisting('//*[contains(text(),"This is a test form.")]') - .then(function (existing) { - test.assert( - existing, - 'Page displays form from API.' + .url('http://localhost:8000/publications/test/test/latest') + .waitForExist( + '//*[contains(text(),"This is a test form.")]', 2000 ) - }) + .isExisting('//*[contains(text(),"This is a test form.")]') + .then(function (existing) { + test.assert( + existing, + 'Page displays form from API.' + ) + }) }) }) @@ -114,17 +114,17 @@ tape('Loading from API', function (suite) { postProject('test', 'test', '1e', form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/publications/test/test') - .waitForExist( - '//*[contains(text(),"This is a test form.")]', 2000 - ) - .isExisting('//*[contains(text(),"This is a test form.")]') - .then(function (existing) { - test.assert( - existing, - 'Page displays form from API.' + .url('http://localhost:8000/publications/test/test') + .waitForExist( + '//*[contains(text(),"This is a test form.")]', 2000 ) - }) + .isExisting('//*[contains(text(),"This is a test form.")]') + .then(function (existing) { + test.assert( + existing, + 'Page displays form from API.' + ) + }) }) }) @@ -133,17 +133,17 @@ tape('Loading from API', function (suite) { postProject('test', 'test', '1e', form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/publications/test/test/current') - .waitForExist( - '//*[contains(text(),"This is a test form.")]', 2000 - ) - .isExisting('//*[contains(text(),"This is a test form.")]') - .then(function (existing) { - test.assert( - existing, - 'Page displays form from API.' + .url('http://localhost:8000/publications/test/test/current') + .waitForExist( + '//*[contains(text(),"This is a test form.")]', 2000 ) - }) + .isExisting('//*[contains(text(),"This is a test form.")]') + .then(function (existing) { + test.assert( + existing, + 'Page displays form from API.' + ) + }) }) }) }) diff --git a/test/post-form.js b/test/post-form.js index 3621c24f..80940b19 100644 --- a/test/post-form.js +++ b/test/post-form.js @@ -18,5 +18,5 @@ module.exports = function (form, callback) { callback(new Error('Responded ' + code)) } }) - .end(JSON.stringify(form)) + .end(JSON.stringify(form)) } diff --git a/test/post-project.js b/test/post-project.js index 0bbeda0f..d6d904f6 100644 --- a/test/post-project.js +++ b/test/post-project.js @@ -43,11 +43,11 @@ function createPublisher (publisher, callback) { callback(new Error('Responded ' + code)) } }) - .end(JSON.stringify({ - about: '', - email: publisher + '@example.com', - password: TERRIBLE_PASSWORD - })) + .end(JSON.stringify({ + about: '', + email: publisher + '@example.com', + password: TERRIBLE_PASSWORD + })) } function publish (publisher, project, edition, digest, callback) { @@ -69,7 +69,7 @@ function publish (publisher, project, edition, digest, callback) { callback(new Error('Responded ' + code)) } }) - .end(JSON.stringify({ - digest: digest - })) + .end(JSON.stringify({ + digest: digest + })) } diff --git a/test/signature-pages.test.js b/test/signature-pages.test.js index 3ae1a3ee..8a12fea8 100644 --- a/test/signature-pages.test.js +++ b/test/signature-pages.test.js @@ -26,17 +26,17 @@ tape.test('Signature Pages', function (test) { postForm(form, function (error) { test.ifError(error, 'no error') webdriver - .url(testURL) - .waitForExist(addButton) - .click(addButton) - .isExisting(pageFollows) - .then(function (existing) { - test.assert( - existing, - 'On clicking "Add Signature Page", ' + - 'the text "Signature Page Follows" appears.' - ) - }) + .url(testURL) + .waitForExist(addButton) + .click(addButton) + .isExisting(pageFollows) + .then(function (existing) { + test.assert( + existing, + 'On clicking "Add Signature Page", ' + + 'the text "Signature Page Follows" appears.' + ) + }) }) }) @@ -45,18 +45,18 @@ tape.test('Signature Pages', function (test) { postForm(form, function (error) { test.ifError(error, 'no error') webdriver - .url(testURL) - .waitForExist(addButton) - .click(addButton) - .click(addButton) - .isExisting(pagesFollow) - .then(function (existing) { - test.assert( - existing, - 'On clicking "Add Signature Page" twice, ' + - 'the text "Signature Pages Follow" appears.' - ) - }) + .url(testURL) + .waitForExist(addButton) + .click(addButton) + .click(addButton) + .isExisting(pagesFollow) + .then(function (existing) { + test.assert( + existing, + 'On clicking "Add Signature Page" twice, ' + + 'the text "Signature Pages Follow" appears.' + ) + }) }) }) @@ -65,20 +65,20 @@ tape.test('Signature Pages', function (test) { postForm(form, function (error) { test.ifError(error, 'no error') webdriver - .url(testURL) - .waitForExist(addButton) - .click(addButton) - .waitForExist(deleteButton) - .click(deleteButton) - .isExisting(pageFollows) - .then(function (existing) { - test.assert( - !existing, - 'On clicking "Add Signature Page" ' + - 'and then "Delete this Signature Page", ' + - 'the text "Signature Page Follows" disappears.' - ) - }) + .url(testURL) + .waitForExist(addButton) + .click(addButton) + .waitForExist(deleteButton) + .click(deleteButton) + .isExisting(pageFollows) + .then(function (existing) { + test.assert( + !existing, + 'On clicking "Add Signature Page" ' + + 'and then "Delete this Signature Page", ' + + 'the text "Signature Page Follows" disappears.' + ) + }) }) }) }) diff --git a/test/typography.test.js b/test/typography.test.js index ab8a7f57..60c3e5ec 100644 --- a/test/typography.test.js +++ b/test/typography.test.js @@ -13,14 +13,14 @@ tape('Typography', function (suite) { postForm(form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/forms/' + digest) - .isExisting('//*[contains(text(),"Wouldn’t")]') - .then(function (existing) { - test.assert( - existing, - 'Displays "Wouldn’t" with nice quote.' - ) - }) + .url('http://localhost:8000/forms/' + digest) + .isExisting('//*[contains(text(),"Wouldn’t")]') + .then(function (existing) { + test.assert( + existing, + 'Displays "Wouldn’t" with nice quote.' + ) + }) }) }) @@ -33,14 +33,14 @@ tape('Typography', function (suite) { postForm(form, function (error) { test.ifError(error, 'no error') webdriver - .url('http://localhost:8000/forms/' + digest) - .isExisting('//*[contains(text(),"“quotation marks”")]') - .then(function (existing) { - test.assert( - existing, - 'Displays “quotation marks” with nice quotes.' - ) - }) + .url('http://localhost:8000/forms/' + digest) + .isExisting('//*[contains(text(),"“quotation marks”")]') + .then(function (existing) { + test.assert( + existing, + 'Displays “quotation marks” with nice quotes.' + ) + }) }) }) }) diff --git a/test/webdriver.js b/test/webdriver.js index 65d4ffc2..5189bf18 100644 --- a/test/webdriver.js +++ b/test/webdriver.js @@ -1,9 +1,9 @@ var webdriver = module.exports = (function () { return require('webdriverio') - .remote(configuration()) - .init() - .timeouts('script', 1000) - .timeouts('implicit', 1000) + .remote(configuration()) + .init() + .timeouts('script', 1000) + .timeouts('implicit', 1000) })() function configuration () { diff --git a/utilities/annotate.js b/utilities/annotate.js index da4d869a..45a884c3 100644 --- a/utilities/annotate.js +++ b/utilities/annotate.js @@ -9,11 +9,11 @@ module.exports = function (flags, form) { find(annotators, function (annotator) { return annotator.name === name }) - .annotate(form) - .forEach(function (annotation) { - annotation.path = annotation.path.slice(0, -2) - annotations.push(annotation) - }) + .annotate(form) + .forEach(function (annotation) { + annotation.path = annotation.path.slice(0, -2) + annotations.push(annotation) + }) } }) return treeify(annotations) diff --git a/utilities/replace-unicode.js b/utilities/replace-unicode.js index 5271d994..541793c8 100644 --- a/utilities/replace-unicode.js +++ b/utilities/replace-unicode.js @@ -3,7 +3,7 @@ var equivalents = require('unicode-ascii-equivalents') module.exports = function (string) { return equivalents.reduce(function (returned, equivalence) { return returned - .split(equivalence.unicode) - .join(equivalence.ascii) + .split(equivalence.unicode) + .join(equivalence.ascii) }, string) } diff --git a/views/projects.js b/views/projects.js index 27ef1841..4a1d42a7 100644 --- a/views/projects.js +++ b/views/projects.js @@ -62,12 +62,14 @@ function projectItem (publisher, project, editions, send) { diff --git a/views/search.js b/views/search.js index f887b2c5..a90cff60 100644 --- a/views/search.js +++ b/views/search.js @@ -161,6 +161,6 @@ var patterns = [ function normalizeQuery (string) { return string - .toLowerCase() - .replace(/[^a-z0-9 '-]/g, '') + .toLowerCase() + .replace(/[^a-z0-9 '-]/g, '') }