UNPKG

wsemi

Version:

A support package for web developer.

65 lines (58 loc) 2.63 kB
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-tw"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>examples for strFindFuzzDyn(fuse.js)</title> <!-- @babel/polyfill已廢棄 --> <script nomodule src="https://cdn.jsdelivr.net/npm/@babel/polyfill@7.12.1/dist/polyfill.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/wsemi@1.7.19/dist/wsemi.umd.js"></script> <script> let log = console.log console.log = function(){ log.apply(null, arguments) wsemi.bodyLog.apply(null, arguments) } </script> </head> <body> <script> Promise.resolve() .then(function() { //第2參數會被空白切分成多關鍵字 return wsemi.strFindFuzzDyn('Wodooman(樵夫)', 'The Woodman(樵夫) set to work at once, and so...', true) .then(function(r) { console.log("strFindFuzz('Wodooman(樵夫)', 'The Woodman(樵夫) set to work at once, and so...', true)", r) // => 31.831649831649834 }) }) .then(function() { return wsemi.strFindFuzzDyn('The Woodman(樵夫) set to work at once, and so...', 'Wodooman(樵夫)', true) .then(function(r) { console.log("strFindFuzz('The Woodman(樵夫) set to work at once, and so...', 'Wodooman(樵夫)', true)", r) // => 40.845872267054474 }) }) .then(function() { return wsemi.strFindFuzzDyn(['abc', 'def123', '中文測試'], 'ef', true) .then(function(r) { console.log("strFindFuzz(['abc', 'def123', '中文測試'], 'ef', true)", r) // => 100 }) }) .then(function() { return wsemi.strFindFuzzDyn(['abc', 'def123', '中文測試'], 'efgg', true) .then(function(r) { console.log("strFindFuzz(['abc', 'def123', '中文測試'], 'efgg', true)", r) // => 46 }) }) .then(function() { return wsemi.strFindFuzzDyn(['abc', 'def123', '中文測試'], 'ef') .then(function(r) { console.log("strFindFuzz(['abc', 'def123', '中文測試'], 'ef')", r) // => true }) }) </script> </body> </html>