binary-data
Version:
Declarative binary data encoder / decoder.
1 lines • 1.34 kB
Source Map (JSON)
{"version":3,"sources":["index.js"],"names":["binary","require","describe","test","length","buf","Buffer","allocUnsafe","rstream","createDecodeStream","expect","toEqual","readBuffer"],"mappings":"AAAA;;AAEA,MAAMA,SAASC,QAAQ,OAAR,CAAf;;AAEAC,SAAS,oBAAT,EAA+B,MAAM;AACnCC,OAAK,wCAAL,EAA+C,MAAM;AACnD,UAAMC,SAAS,CAAf;AACA,UAAMC,MAAMC,OAAOC,WAAP,CAAmBH,MAAnB,CAAZ;;AAEA,UAAMI,UAAUR,OAAOS,kBAAP,CAA0BJ,GAA1B,CAAhB;AACAK,WAAOF,QAAQJ,MAAf,EAAuBO,OAAvB,CAA+BP,MAA/B;AACAM,WAAOF,QAAQI,UAAR,CAAmBR,MAAnB,CAAP,EAAmCO,OAAnC,CAA2CN,GAA3C;AACD,GAPD;;AASAF,OAAK,4CAAL,EAAmD,MAAM;AACvDO,WAAOV,OAAOS,kBAAP,GAA4BL,MAAnC,EAA2CO,OAA3C,CAAmD,CAAnD;AACAD,WAAOV,OAAOS,kBAAP,CAA0B,EAA1B,EAA8BL,MAArC,EAA6CO,OAA7C,CAAqD,CAArD;AACD,GAHD;AAID,CAdD","file":"index.js","sourcesContent":["'use strict';\n\nconst binary = require('index');\n\ndescribe('createDecodeStream', () => {\n test('should accept buffer as first argument', () => {\n const length = 2;\n const buf = Buffer.allocUnsafe(length);\n\n const rstream = binary.createDecodeStream(buf);\n expect(rstream.length).toEqual(length);\n expect(rstream.readBuffer(length)).toEqual(buf);\n });\n\n test('should not accept buffer as first argument', () => {\n expect(binary.createDecodeStream().length).toEqual(0);\n expect(binary.createDecodeStream({}).length).toEqual(0);\n });\n});\n"]}