From 52402b8d321aba2af9bf85429c8a79bc04525502 Mon Sep 17 00:00:00 2001 From: Cole Cassidy Date: Tue, 3 Jan 2023 00:24:42 -0500 Subject: [PATCH 1/2] Update README.md Completed Testing with Brother QL-1110NWB --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b6ed710..bf9be23 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ a node.js library to print ptouch label on brother label printer. now tested on: * QL-820NWB +* QL-1110NWB ## Installation From c1c61647ce0d70fc2175ff81b221ff9f0cc437e5 Mon Sep 17 00:00:00 2001 From: Cole Cassidy Date: Mon, 9 Jan 2023 20:05:30 -0500 Subject: [PATCH 2/2] Added insertJSON function - inserts object names and values from JSON object - key is converted to objectName - value is preserved - both are converted to Strings --- lib/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/index.js b/lib/index.js index fac5faa..df9f12c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -19,6 +19,13 @@ ptouch.prototype.insertData = function(objectName, value) { this.objects.push({objectName, value: Buffer.concat(buffers)}); }; +// Inserts Data from JSON converting keys into objectNames +ptouch.prototype.insertJSON = function( jsonDOC ) { + Object.keys(jsonDOC).forEach( (key) => { + this.insertData(String(key), String(jsonDOC[key])) + }); +} + ptouch.prototype.generate = function() { var data = []; data.push(CONSTANTS.PTOUCH_MODE);