Skip to content

Commit

Permalink
Use builtin Array.isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Apr 18, 2020
1 parent 20492aa commit cb7865b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 10 deletions.
3 changes: 1 addition & 2 deletions lib/core/qrcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const Version = require('./version')
const FormatInfo = require('./format-info')
const Mode = require('./mode')
const Segments = require('./segments')
const isArray = require('isarray')

/**
* QRCode for JavaScript
Expand Down Expand Up @@ -379,7 +378,7 @@ function createCodewords (bitBuffer, version, errorCorrectionLevel) {
function createSymbol (data, version, errorCorrectionLevel, maskPattern) {
let segments

if (isArray(data)) {
if (Array.isArray(data)) {
segments = Segments.fromArray(data)
} else if (typeof data === 'string') {
let estimatedVersion = version
Expand Down
3 changes: 1 addition & 2 deletions lib/core/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const ECCode = require('./error-correction-code')
const ECLevel = require('./error-correction-level')
const Mode = require('./mode')
const VersionCheck = require('./version-check')
const isArray = require('isarray')

// Generator polynomial used to encode version information
const G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
Expand Down Expand Up @@ -122,7 +121,7 @@ exports.getBestVersionForData = function getBestVersionForData (data, errorCorre

const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)

if (isArray(data)) {
if (Array.isArray(data)) {
if (data.length > 1) {
return getBestVersionForMixedData(data, ecl)
}
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"dependencies": {
"dijkstrajs": "^1.0.1",
"encode-utf8": "^1.0.3",
"isarray": "^2.0.5",
"pngjs": "^5.0.0",
"uglify-js": "^3.9.1",
"yargs": "^15.3.1"
Expand Down

0 comments on commit cb7865b

Please sign in to comment.