Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/syui/hugo-theme-wave.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'static/bower_components/lunr.js/lib/trimmer.js')
-rw-r--r--static/bower_components/lunr.js/lib/trimmer.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/static/bower_components/lunr.js/lib/trimmer.js b/static/bower_components/lunr.js/lib/trimmer.js
new file mode 100644
index 0000000..0b4160a
--- /dev/null
+++ b/static/bower_components/lunr.js/lib/trimmer.js
@@ -0,0 +1,24 @@
+/*!
+ * lunr.trimmer
+ * Copyright (C) @YEAR Oliver Nightingale
+ */
+
+/**
+ * lunr.trimmer is a pipeline function for trimming non word
+ * characters from the begining and end of tokens before they
+ * enter the index.
+ *
+ * This implementation may not work correctly for non latin
+ * characters and should either be removed or adapted for use
+ * with languages with non-latin characters.
+ *
+ * @module
+ * @param {String} token The token to pass through the filter
+ * @returns {String}
+ * @see lunr.Pipeline
+ */
+lunr.trimmer = function (token) {
+ return token.replace(/^\W+/, '').replace(/\W+$/, '')
+}
+
+lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer')