chore: use throw instead of assert (#18)
This commit is contained in:
Родитель
689bc4fb00
Коммит
5c79ad08f8
9
index.js
9
index.js
|
@ -1,9 +1,12 @@
|
|||
const keycode = require('keycode')
|
||||
const assert = require('assert')
|
||||
|
||||
module.exports = function searchWithYourKeyboard (inputSelector, hitsSelector) {
|
||||
assert(typeof inputSelector === 'string', 'inputSelector should be a string')
|
||||
assert(typeof hitsSelector === 'string', 'hitsSelector should be a string')
|
||||
if (typeof inputSelector !== 'string') {
|
||||
throw new TypeError('inputSelector should be a string')
|
||||
}
|
||||
if (typeof hitsSelector !== 'string') {
|
||||
throw new TypeError('hitsSelector should be a string')
|
||||
}
|
||||
|
||||
let activeIndex = 0
|
||||
const targetEventCodes = ['up', 'down', 'enter', '/', 'esc']
|
||||
|
|
Загрузка…
Ссылка в новой задаче