Skip to content

Commit

Permalink
fix: use String.prototype.normalize() only if it's avalable
Browse files Browse the repository at this point in the history
  • Loading branch information
yumetodo committed Nov 11, 2017
1 parent 5d4d538 commit e7b7315
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/crsearch/index-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class IndexID {
keys = ns.concat(keys)
}
this.cpp_namespace = keys
this.keys = keys.map((k) => k.normalize('NFKC'))
this.keys = (typeof String.prototype.normalize === 'function') ? keys.map((k) => k.normalize('NFKC')) : keys

for (const [k, v] of IndexID.VERBATIM_TRS) {
if (v.only && !arrayIncludes([].concat(v.only), this.type)) {
Expand Down
2 changes: 1 addition & 1 deletion js/crsearch/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Query {
constructor(log, text) {
this.log = log.makeContext('Query')
this.original_text = text
this.frags = text.normalize('NFKC').split(/\s+/).filter(Boolean)
this.frags = ((typeof String.prototype.normalize === 'function') ? text.normalize('NFKC') : text).split(/\s+/).filter(Boolean)

this.filters = new Set

Expand Down

0 comments on commit e7b7315

Please sign in to comment.