diff --git a/helpers/build-video-list.js b/helpers/build-video-list.js index 893a8fe..b1f16ce 100644 --- a/helpers/build-video-list.js +++ b/helpers/build-video-list.js @@ -2,12 +2,9 @@ import slugify from 'slugify' import axios from 'axios' +import { matchesWholeWord } from './matching.js' import { byTimeThenNull } from './sort-list.js' import { getVideoEndpoint } from './app-derived.js' - -export function matchesWholeWord (needle, haystack) { - return new RegExp('\\b' + needle + '\\b').test(haystack) -} import parseDate from './parse-date' const videoFeaturesApp = function (app, video) { diff --git a/helpers/matching.js b/helpers/matching.js new file mode 100644 index 0000000..0ad101c --- /dev/null +++ b/helpers/matching.js @@ -0,0 +1,6 @@ + +// Match whole word +export function matchesWholeWord (needle, haystack) { + return new RegExp('\\b' + needle + '\\b').test(haystack) +} + diff --git a/helpers/related.js b/helpers/related.js index 98eb8f8..819550a 100644 --- a/helpers/related.js +++ b/helpers/related.js @@ -1,10 +1,6 @@ // import { allVideoAppsListSet } from '~/helpers/get-list.js' // import videoList from '~/static/video-list.json' -export function matchesWholeWord (needle, haystack) { - return new RegExp('\\b' + needle + '\\b').test(haystack) -} - export function appsRelatedToVideo ( video, allVideoAppsListSet ) { // console.log('allVideoAppsListSet', allVideoAppsListSet.length)