-
Notifications
You must be signed in to change notification settings - Fork 56
/
levenshtein.min.js
2 lines (2 loc) · 1.13 KB
/
levenshtein.min.js
1
2
/*! fast-levenshtein 2020-07-22. Copyright Ramesh Nair <[email protected]> (http://www.hiddentao.com/) */
!function(){"use strict";var a;try{a="undefined"!=typeof Intl&&"undefined"!=typeof Intl.Collator?Intl.Collator("generic",{sensitivity:"base"}):null}catch(b){console.log("Collator could not be initialized and wouldn't be used")}var c=require("fastest-levenshtein"),d=[],e=[],f={get:function(b,f,g){var h=g&&a&&g.useCollator;if(h){var i=b.length,j=f.length;if(0===i)return j;if(0===j)return i;var k,l,m,n,o;for(m=0;j>m;++m)d[m]=m,e[m]=f.charCodeAt(m);d[j]=j;var p;for(m=0;i>m;++m){for(l=m+1,n=0;j>n;++n)k=l,p=0===a.compare(b.charAt(m),String.fromCharCode(e[n])),l=d[n]+(p?0:1),o=k+1,l>o&&(l=o),o=d[n+1]+1,l>o&&(l=o),d[n]=k;d[n]=l}return l}return c.distance(b,f)}};"undefined"!=typeof define&&null!==define&&define.amd?define(function(){return f}):"undefined"!=typeof module&&null!==module&&"undefined"!=typeof exports&&module.exports===exports?module.exports=f:"undefined"!=typeof self&&"function"==typeof self.postMessage&&"function"==typeof self.importScripts?self.Levenshtein=f:"undefined"!=typeof window&&null!==window&&(window.Levenshtein=f)}();