Use builtin Array.isArray
This commit is contained in:
parent
20492aa7ca
commit
cb7865b9ee
4 changed files with 2 additions and 10 deletions
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
|
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -2834,11 +2834,6 @@
|
|||
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
|
||||
"dev": true
|
||||
},
|
||||
"isarray": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="
|
||||
},
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue