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

Commit

Permalink
fix: fix incompatibility with zii via @rvagg's fix (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleMaas authored Feb 26, 2021
1 parent c373031 commit d5b670f
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit d5b670f

Please sign in to comment.