MCPcopy
hub / github.com/LeaVerou/awesomplete / configure

Function configure

awesomplete.js:431–453  ·  view source on GitHub ↗
(instance, properties, o)

Source from the content-addressed store, hash-verified

429};
430
431function configure(instance, properties, o) {
432 for (var i in properties) {
433 var initial = properties[i],
434 attrValue = instance.input.getAttribute("data-" + i.toLowerCase());
435
436 if (typeof initial === "number") {
437 instance[i] = parseInt(attrValue);
438 }
439 else if (initial === false) { // Boolean options must be false by default anyway
440 instance[i] = attrValue !== null;
441 }
442 else if (initial instanceof Function) {
443 instance[i] = null;
444 }
445 else {
446 instance[i] = attrValue;
447 }
448
449 if (!instance[i] && instance[i] !== 0) {
450 instance[i] = (i in o)? o[i] : initial;
451 }
452 }
453}
454
455// Helpers
456

Callers 1

_Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected