Skip to content

Commit

Permalink
Alterando variaveis de let para const e mudando os valores da linha 1…
Browse files Browse the repository at this point in the history
…5 e 81 para !== e ===
  • Loading branch information
adelmojnr committed Jun 19, 2019
1 parent 90d102e commit 7ad1187
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/barcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.binaryRepresentationForBarcodeData = function (barcodeData) {
9: '01010'
}

if (barcodeData.length % 2 != 0) {
if (barcodeData.length % 2 !== 0) {
barcodeData = '0' + barcodeData
}

Expand All @@ -35,7 +35,7 @@ exports.binaryRepresentationForBarcodeData = function (barcodeData) {

// Convert a value to a little endian hexadecimal value
exports._getLittleEndianHex = function (value) {
let result = []
const result = []

for (let bytes = 4; bytes > 0; bytes--) {
result.push(String.fromCharCode(value & 0xff))
Expand Down Expand Up @@ -69,16 +69,16 @@ exports._bmpHeader = function (width, height) {
}

exports.bmpLineForBarcodeData = function (barcodeData) {
let binaryRepresentation = exports.binaryRepresentationForBarcodeData(barcodeData)
const binaryRepresentation = exports.binaryRepresentationForBarcodeData(barcodeData)

let bmpData = []
let black = true
let offset = 0

for (let i = 0; i < binaryRepresentation.length; i++) {
let digit = binaryRepresentation[i]
let color = black ? String.fromCharCode(0, 0, 0, 0) : String.fromCharCode(255, 255, 255, 0)
let pixelsToDraw = (digit == '0') ? 1 : 3
const digit = binaryRepresentation[i]
const color = black ? String.fromCharCode(0, 0, 0, 0) : String.fromCharCode(255, 255, 255, 0)
let pixelsToDraw = (digit === '0') ? 1 : 3

for (let j = 0; j < pixelsToDraw; j++) {
bmpData[offset++] = color
Expand Down

0 comments on commit 7ad1187

Please sign in to comment.