MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / checkCodePoint

Function checkCodePoint

javascript/selenium-webdriver/lib/input.js:247–261  ·  view source on GitHub ↗

* @param {(string|Key|number)} key * @return {string} * @throws {!(InvalidArgumentError|RangeError)}

(key)

Source from the content-addressed store, hash-verified

245 * @throws {!(InvalidArgumentError|RangeError)}
246 */
247function checkCodePoint(key) {
248 if (typeof key === 'number') {
249 return String.fromCodePoint(key)
250 }
251
252 if (typeof key !== 'string') {
253 throw new InvalidArgumentError(`key is not a string: ${key}`)
254 }
255
256 key = key.normalize()
257 if (Array.from(key).length !== 1) {
258 throw new InvalidArgumentError(`key input is not a single code point: ${key}`)
259 }
260 return key
261}
262
263/**
264 * Keyboard input device.

Callers 2

keyDownMethod · 0.85
keyUpMethod · 0.85

Calls 2

normalizeMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected