Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Fix incompatibility with zii via @rvagg's fix #84

Merged
merged 3 commits into from
Feb 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function validEncode (name, buf) {
* @throws {Error} Will throw if the encoding is not supported
*/
function encoding (nameOrCode) {
if (constants.names[/** @type {BaseName} */(nameOrCode)]) {
if (Object.prototype.hasOwnProperty.call(constants.names, /** @type {BaseName} */(nameOrCode))) {
return constants.names[/** @type {BaseName} */(nameOrCode)]
} else if (constants.codes[/** @type {BaseCode} */(nameOrCode)]) {
} else if (Object.prototype.hasOwnProperty.call(constants.codes, /** @type {BaseCode} */(nameOrCode))) {
return constants.codes[/** @type {BaseCode} */(nameOrCode)]
} else {
throw new Error(`Unsupported encoding: ${nameOrCode}`)
Expand Down