Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tarekraafat/autocomplete.js

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tarekraafat/autocomplete.js - npm Package Compare versions

Comparing version 10.0.2 to 10.0.3

10

dist/autoComplete.js

@@ -235,4 +235,4 @@

var format = function format(value, diacritics) {
value = value.toLowerCase();
return (diacritics ? value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").normalize("NFC") : value).toString();
value = value.toString().toLowerCase();
return diacritics ? value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").normalize("NFC") : value;
};

@@ -273,2 +273,3 @@ var debounce = function debounce(callback, duration) {

var nRecord = format(record, diacritics);
record = record.toString();
query = format(query, diacritics);

@@ -439,6 +440,3 @@ if (mode === "loose") {

ctx.input.setAttribute(Active, results[ctx.cursor].id);
results[index].scrollIntoView({
behavior: ctx.resultsList.scroll || "smooth",
block: "center"
});
ctx.list.scrollTop = results[index].offsetTop - ctx.list.clientHeight + results[index].clientHeight + 5;
ctx.feedback.cursor = ctx.cursor;

@@ -445,0 +443,0 @@ feedback(ctx, index);

2

dist/autoComplete.min.js

@@ -1,1 +0,1 @@

var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s,a=function(e){new MutationObserver((function(t,n){t.forEach((function(t){e.input&&(n.disconnect(),e.init())}))})).observe(document,{childList:!0,subtree:!0})},c=function(e){return"string"==typeof e?document.querySelector(e):e},l=function(e,t){var n="string"==typeof e?document.createElement(e):e;for(var r in t){var i=t[r];if("inside"===r)i.append(n);else if("dest"===r)c(i[0]).insertAdjacentElement(i[1],n);else if("around"===r){var o=c(i);o.parentNode.insertBefore(n,o),n.append(o),null!=o.getAttribute("autofocus")&&o.focus()}else r in n?n[r]=i:n.setAttribute(r,i)}return n},f=function(e,t){return e=e.toLowerCase(),(t?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):e).toString()},d=function(e,n){return l("mark",t({innerHTML:e},"string"==typeof n&&{classes:n})).outerHTML},p=function(e,t){t.input.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t.feedback,cancelable:!0}))},m=function(e,t,n){var r=n||{},i=r.mode,o=r.diacritics,u=r.highlight,s=f(t,o);if(e=f(e,o),"loose"===i){var a=(e=e.replace(/ /g,"")).length,c=0,l=Array.from(t).map((function(t,n){return c<a&&s[n]===e[c]&&(t=u?d(t,u):t,c++),t})).join("");if(c===a)return l}else{var p=s.indexOf(e);if(~p)return e=t.substring(p,p+e.length),p=u?t.replace(e,d(e,u)):t}},v=function(e){return new Promise((function(t,n){var r,i;return r=e.input,(i=e.data).cache&&i.store?t():new Promise((function(e,t){return"function"==typeof i.src?i.src(r.value).then(e,t):e(i.src)})).then((function(r){try{return e.feedback=i.store=r,p("response",e),t()}catch(e){return n(e)}}),n)}))},h=function(e,t){var n=t.data,r=t.searchEngine,i=t.diacritics,u=t.resultsList,s=t.resultItem,a=[];n.store.forEach((function(t,u){var c=function(n){var o=n?t[n]:t,u="function"==typeof r?r(e,o):m(e,o,{mode:r,diacritics:i,highlight:s.highlight});if(u){var c={match:u,value:t};n&&(c.key=n),a.push(c)}};if(n.keys){var l,f=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=o(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,u=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw u}}}}(n.keys);try{for(f.s();!(l=f.n()).done;)c(l.value)}catch(e){f.e(e)}finally{f.f()}}else c()})),n.filter&&(a=n.filter(a));var c=a.slice(0,u.maxResults);t.feedback={query:e,matches:a,results:c},p("results",t)},b="aria-expanded",y="aria-activedescendant",g="aria-selected",w=function(e,n){e.feedback.selection=t({index:n},e.feedback.results[n])},O=function(e){e.isOpen||(e.wrapper.setAttribute(b,!0),e.list.removeAttribute("hidden"),e.isOpen=!0,p("open",e))},L=function(e){e.isOpen&&(e.wrapper.setAttribute(b,!1),e.input.setAttribute(y,""),e.list.setAttribute("hidden",""),e.isOpen=!1,p("close",e))},A=function(e,t){var n=t.list.getElementsByTagName(t.resultItem.tag);if(t.isOpen&&n.length){var r,o,u=t.cursor;e>=n.length&&(e=0),e<0&&(e=n.length-1),t.cursor=e,u>-1&&(n[u].removeAttribute(g),s&&(o=n[u].classList).remove.apply(o,i(s))),n[e].setAttribute(g,!0),s&&(r=n[e].classList).add.apply(r,i(s)),t.input.setAttribute(y,n[t.cursor].id),n[e].scrollIntoView({behavior:t.resultsList.scroll||"smooth",block:"center"}),t.feedback.cursor=t.cursor,w(t,e),p("navigate",t)}},S=function(e){var t=e.cursor+1;A(t,e)},j=function(e){var t=e.cursor-1;A(t,e)},k=function(e,t,n){(n=n>=0?n:e.cursor)<0||(e.feedback.event=t,w(e,n),p("selection",e),L(e))};function E(e){var n=this;return new Promise((function(r,i){var o,u,s,a,c,f,d;return o=e.input,u=e.query,s=e.trigger,a=e.threshold,c=e.resultsList,f=(d=o)instanceof HTMLInputElement||d instanceof HTMLTextAreaElement?d.value:d.innerHTML,function(e,t,n){return t?t(e):e.length>=n}(f=u?u(f):f,s,a)?v(e).then((function(r){try{return h(f,e),c&&function(e){var n=e.resultsList,r=e.list,i=e.resultItem,o=e.feedback;o.query;var u=o.matches,s=o.results;if(e.cursor=-1,r.innerHTML="",u.length||n.noResults){var a=document.createDocumentFragment();s.forEach((function(e,n){var r=l(i.tag,t({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:e.match,inside:a},i.class&&{class:i.class}));i.element&&i.element(r,e)})),r.append(a),n.element&&n.element(r,o),O(e)}else L(e)}(e),p.call(n)}catch(e){return i(e)}}),i):(L(e),p.call(n));function p(){return r()}}))}var I=function(e,t){for(var n in e)for(var r in e[n])t(r,n)},T=function(e){var n=e.events;e.trigger;var r=e.debounce,i=e.resultsList,o=function(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){return e()}),t)}}((function(){return E(e)}),r),u=e.events=t({input:t({},n&&n.input)},i&&{list:n?t({},n.list):{}}),a={input:{input:function(){o()},keydown:function(t){!function(e,t){var n=e.keyCode,r=t.resultItem.selected;switch(r&&(s=r.split(" ")),n){case 40:case 38:e.preventDefault(),40===n?S(t):j(t);break;case 13:e.preventDefault(),t.cursor>=0&&k(t,e);break;case 9:t.resultsList.tabSelect&&t.cursor>=0?(e.preventDefault(),k(t,e)):L(t);break;case 27:e.preventDefault(),t.input.value="",L(t)}}(t,e)},blur:function(){L(e)}},list:{mousedown:function(e){e.preventDefault()},click:function(t){!function(e,t){var n=t.resultItem.tag.toUpperCase(),r=Array.from(t.list.children),i=e.target.closest(n);if(i&&i.nodeName===n){e.preventDefault();var o=r.indexOf(i)-1;k(t,e,o)}}(t,e)}}};I(a,(function(e,t){(i||"list"!==t)&&(u[t][e]||(u[t][e]=a[t][e]))})),I(u,(function(t,n){e[n].addEventListener(t,u[n][t])}))};function x(e){var n=this;return new Promise((function(r,i){var o,u,s,a,c;if(o=e.name,u=e.input,s=e.placeHolder,a=e.resultsList,c=e.data,l(u,t({"aria-controls":a.id,"aria-autocomplete":"both"},s&&{placeholder:s})),e.wrapper=l("div",{around:u,class:o+"_wrapper",role:"combobox","aria-owns":a.id,"aria-haspopup":!0,"aria-expanded":!1}),a&&(e.list=l(a.tag,t({dest:["string"==typeof a.destination?document.querySelector(a.destination):a.destination(),a.position],id:a.id,role:"listbox",hidden:"hidden"},a.class&&{class:a.class}))),c.cache)return v(e).then((function(e){try{return f.call(n)}catch(e){return i(e)}}),i);function f(){return T(e),p("init",e),r()}return f.call(n)}))}function D(e){var t=this,n=e.prototype;n.preInit=function(){return a(t)},n.init=function(){return x(t)},n.start=function(){return E(t)},n.unInit=function(){var e;I((e=t).events,(function(t,n){e[n].removeEventListener(t,e.events[n][t])}))},n.open=function(){return O(t)},n.close=function(){return L(t)},n.goTo=function(e){return A(e,t)},n.next=function(){return S(t)},n.previous=function(){return j(t)},n.select=function(e){return k(t,null,e)},e.search=n.search=function(e,t,n){return m(e,t,n)}}return function e(t){this.options=t,this.id=e.instances=(e.instances||0)+1,this.name="autoComplete",this.threshold=1,this.debounce=0,this.resultsList={position:"afterend",tag:"ul",maxResults:5},this.resultItem={tag:"li"},function(e){var t=e.id,r=e.name,i=e.options,o=e.resultsList,u=e.resultItem;for(var s in i)if("object"===n(i[s]))for(var a in e[s]||(e[s]={}),i[s])e[s][a]=i[s][a];else e[s]=i[s];e.selector=e.selector||"#"+r,o.destination=o.destination||e.selector,o.id=o.id||r+"_list_"+t,u.id=u.id||r+"_result",e.input="string"==typeof e.selector?document.querySelector(e.selector):e.selector()}(this),D.call(this,e);var r=this.observe?a:x;"loading"!==document.readyState?r(this):document.addEventListener("DOMContentLoaded",r(this))}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).autoComplete=t();
var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s,a=function(e){new MutationObserver((function(t,n){t.forEach((function(t){e.input&&(n.disconnect(),e.init())}))})).observe(document,{childList:!0,subtree:!0})},c=function(e){return"string"==typeof e?document.querySelector(e):e},l=function(e,t){var n="string"==typeof e?document.createElement(e):e;for(var r in t){var i=t[r];if("inside"===r)i.append(n);else if("dest"===r)c(i[0]).insertAdjacentElement(i[1],n);else if("around"===r){var o=c(i);o.parentNode.insertBefore(n,o),n.append(o),null!=o.getAttribute("autofocus")&&o.focus()}else r in n?n[r]=i:n.setAttribute(r,i)}return n},f=function(e,t){return e=e.toString().toLowerCase(),t?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").normalize("NFC"):e},d=function(e,n){return l("mark",t({innerHTML:e},"string"==typeof n&&{classes:n})).outerHTML},p=function(e,t){t.input.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t.feedback,cancelable:!0}))},m=function(e,t,n){var r=n||{},i=r.mode,o=r.diacritics,u=r.highlight,s=f(t,o);if(t=t.toString(),e=f(e,o),"loose"===i){var a=(e=e.replace(/ /g,"")).length,c=0,l=Array.from(t).map((function(t,n){return c<a&&s[n]===e[c]&&(t=u?d(t,u):t,c++),t})).join("");if(c===a)return l}else{var p=s.indexOf(e);if(~p)return e=t.substring(p,p+e.length),p=u?t.replace(e,d(e,u)):t}},v=function(e){return new Promise((function(t,n){var r,i;return r=e.input,(i=e.data).cache&&i.store?t():new Promise((function(e,t){return"function"==typeof i.src?i.src(r.value).then(e,t):e(i.src)})).then((function(r){try{return e.feedback=i.store=r,p("response",e),t()}catch(e){return n(e)}}),n)}))},h=function(e,t){var n=t.data,r=t.searchEngine,i=t.diacritics,u=t.resultsList,s=t.resultItem,a=[];n.store.forEach((function(t,u){var c=function(n){var o=n?t[n]:t,u="function"==typeof r?r(e,o):m(e,o,{mode:r,diacritics:i,highlight:s.highlight});if(u){var c={match:u,value:t};n&&(c.key=n),a.push(c)}};if(n.keys){var l,f=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=o(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,u=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw u}}}}(n.keys);try{for(f.s();!(l=f.n()).done;)c(l.value)}catch(e){f.e(e)}finally{f.f()}}else c()})),n.filter&&(a=n.filter(a));var c=a.slice(0,u.maxResults);t.feedback={query:e,matches:a,results:c},p("results",t)},b="aria-expanded",y="aria-activedescendant",g="aria-selected",w=function(e,n){e.feedback.selection=t({index:n},e.feedback.results[n])},O=function(e){e.isOpen||(e.wrapper.setAttribute(b,!0),e.list.removeAttribute("hidden"),e.isOpen=!0,p("open",e))},A=function(e){e.isOpen&&(e.wrapper.setAttribute(b,!1),e.input.setAttribute(y,""),e.list.setAttribute("hidden",""),e.isOpen=!1,p("close",e))},L=function(e,t){var n=t.list.getElementsByTagName(t.resultItem.tag);if(t.isOpen&&n.length){var r,o,u=t.cursor;e>=n.length&&(e=0),e<0&&(e=n.length-1),t.cursor=e,u>-1&&(n[u].removeAttribute(g),s&&(o=n[u].classList).remove.apply(o,i(s))),n[e].setAttribute(g,!0),s&&(r=n[e].classList).add.apply(r,i(s)),t.input.setAttribute(y,n[t.cursor].id),t.list.scrollTop=n[e].offsetTop-t.list.clientHeight+n[e].clientHeight+5,t.feedback.cursor=t.cursor,w(t,e),p("navigate",t)}},S=function(e){var t=e.cursor+1;L(t,e)},j=function(e){var t=e.cursor-1;L(t,e)},k=function(e,t,n){(n=n>=0?n:e.cursor)<0||(e.feedback.event=t,w(e,n),p("selection",e),A(e))};function E(e){var n=this;return new Promise((function(r,i){var o,u,s,a,c,f,d;return o=e.input,u=e.query,s=e.trigger,a=e.threshold,c=e.resultsList,f=(d=o)instanceof HTMLInputElement||d instanceof HTMLTextAreaElement?d.value:d.innerHTML,function(e,t,n){return t?t(e):e.length>=n}(f=u?u(f):f,s,a)?v(e).then((function(r){try{return h(f,e),c&&function(e){var n=e.resultsList,r=e.list,i=e.resultItem,o=e.feedback;o.query;var u=o.matches,s=o.results;if(e.cursor=-1,r.innerHTML="",u.length||n.noResults){var a=document.createDocumentFragment();s.forEach((function(e,n){var r=l(i.tag,t({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:e.match,inside:a},i.class&&{class:i.class}));i.element&&i.element(r,e)})),r.append(a),n.element&&n.element(r,o),O(e)}else A(e)}(e),p.call(n)}catch(e){return i(e)}}),i):(A(e),p.call(n));function p(){return r()}}))}var T=function(e,t){for(var n in e)for(var r in e[n])t(r,n)},I=function(e){var n=e.events;e.trigger;var r=e.debounce,i=e.resultsList,o=function(e,t){var n;return function(){clearTimeout(n),n=setTimeout((function(){return e()}),t)}}((function(){return E(e)}),r),u=e.events=t({input:t({},n&&n.input)},i&&{list:n?t({},n.list):{}}),a={input:{input:function(){o()},keydown:function(t){!function(e,t){var n=e.keyCode,r=t.resultItem.selected;switch(r&&(s=r.split(" ")),n){case 40:case 38:e.preventDefault(),40===n?S(t):j(t);break;case 13:e.preventDefault(),t.cursor>=0&&k(t,e);break;case 9:t.resultsList.tabSelect&&t.cursor>=0?(e.preventDefault(),k(t,e)):A(t);break;case 27:e.preventDefault(),t.input.value="",A(t)}}(t,e)},blur:function(){A(e)}},list:{mousedown:function(e){e.preventDefault()},click:function(t){!function(e,t){var n=t.resultItem.tag.toUpperCase(),r=Array.from(t.list.children),i=e.target.closest(n);if(i&&i.nodeName===n){e.preventDefault();var o=r.indexOf(i)-1;k(t,e,o)}}(t,e)}}};T(a,(function(e,t){(i||"list"!==t)&&(u[t][e]||(u[t][e]=a[t][e]))})),T(u,(function(t,n){e[n].addEventListener(t,u[n][t])}))};function x(e){var n=this;return new Promise((function(r,i){var o,u,s,a,c;if(o=e.name,u=e.input,s=e.placeHolder,a=e.resultsList,c=e.data,l(u,t({"aria-controls":a.id,"aria-autocomplete":"both"},s&&{placeholder:s})),e.wrapper=l("div",{around:u,class:o+"_wrapper",role:"combobox","aria-owns":a.id,"aria-haspopup":!0,"aria-expanded":!1}),a&&(e.list=l(a.tag,t({dest:["string"==typeof a.destination?document.querySelector(a.destination):a.destination(),a.position],id:a.id,role:"listbox",hidden:"hidden"},a.class&&{class:a.class}))),c.cache)return v(e).then((function(e){try{return f.call(n)}catch(e){return i(e)}}),i);function f(){return I(e),p("init",e),r()}return f.call(n)}))}function D(e){var t=this,n=e.prototype;n.preInit=function(){return a(t)},n.init=function(){return x(t)},n.start=function(){return E(t)},n.unInit=function(){var e;T((e=t).events,(function(t,n){e[n].removeEventListener(t,e.events[n][t])}))},n.open=function(){return O(t)},n.close=function(){return A(t)},n.goTo=function(e){return L(e,t)},n.next=function(){return S(t)},n.previous=function(){return j(t)},n.select=function(e){return k(t,null,e)},e.search=n.search=function(e,t,n){return m(e,t,n)}}return function e(t){this.options=t,this.id=e.instances=(e.instances||0)+1,this.name="autoComplete",this.threshold=1,this.debounce=0,this.resultsList={position:"afterend",tag:"ul",maxResults:5},this.resultItem={tag:"li"},function(e){var t=e.id,r=e.name,i=e.options,o=e.resultsList,u=e.resultItem;for(var s in i)if("object"===n(i[s]))for(var a in e[s]||(e[s]={}),i[s])e[s][a]=i[s][a];else e[s]=i[s];e.selector=e.selector||"#"+r,o.destination=o.destination||e.selector,o.id=o.id||r+"_list_"+t,u.id=u.id||r+"_result",e.input="string"==typeof e.selector?document.querySelector(e.selector):e.selector()}(this),D.call(this,e);var r=this.observe?a:x;"loading"!==document.readyState?r(this):document.addEventListener("DOMContentLoaded",r(this))}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).autoComplete=t();
{
"version": "10.0.2",
"version": "10.0.3",
"name": "@tarekraafat/autocomplete.js",

@@ -4,0 +4,0 @@ "description": "Simple autocomplete pure vanilla Javascript library.",

@@ -50,3 +50,3 @@ # autoComplete.js :sparkles:

```html
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.0.2/dist/autoComplete.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.0.3/dist/autoComplete.min.js"></script>
```

@@ -57,3 +57,3 @@

```html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.0.2/dist/css/autoComplete.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.0.3/dist/css/autoComplete.min.css">
```

@@ -60,0 +60,0 @@ #### Package Manager

@@ -149,3 +149,3 @@ import { create } from "../helpers/io";

// Scroll to selection
results[index].scrollIntoView({ behavior: ctx.resultsList.scroll || "smooth", block: "center" });
ctx.list.scrollTop = results[index].offsetTop - ctx.list.clientHeight + results[index].clientHeight + 5;

@@ -152,0 +152,0 @@ // Prepare Selection data feedback object

@@ -16,2 +16,3 @@ import { format, mark } from "../helpers/io";

const nRecord = format(record, diacritics);
record = record.toString();
query = format(query, diacritics);

@@ -18,0 +19,0 @@

@@ -65,12 +65,10 @@ /**

const format = (value, diacritics) => {
value = value.toLowerCase();
value = value.toString().toLowerCase();
return (
diacritics
? value
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.normalize("NFC")
: value
).toString();
return diacritics
? value
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.normalize("NFC")
: value;
};

@@ -77,0 +75,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc