[SignalingServer] Optimize dependent modules
[platform/framework/web/wrtjs.git] / device_home / node_modules / qrcode / lib / core / byte-data.js
1 var BufferUtil = require('../utils/buffer')
2 var Mode = require('./mode')
3
4 function ByteData (data) {
5   this.mode = Mode.BYTE
6   this.data = BufferUtil.from(data)
7 }
8
9 ByteData.getBitsLength = function getBitsLength (length) {
10   return length * 8
11 }
12
13 ByteData.prototype.getLength = function getLength () {
14   return this.data.length
15 }
16
17 ByteData.prototype.getBitsLength = function getBitsLength () {
18   return ByteData.getBitsLength(this.data.length)
19 }
20
21 ByteData.prototype.write = function (bitBuffer) {
22   for (var i = 0, l = this.data.length; i < l; i++) {
23     bitBuffer.put(this.data[i], 8)
24   }
25 }
26
27 module.exports = ByteData