From 33d0656f0c597238c7105d66c416c03524ac596c Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 13 Apr 2022 11:19:26 +0100 Subject: [PATCH] Modernised Usage example in README --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4a2fca5cd..6ca780031 100644 --- a/README.md +++ b/README.md @@ -69,21 +69,21 @@ See the [API documentation](https://github.com/TryGhost/node-sqlite3/wiki/API) i **Note:** the module must be [installed](#installing) before use. ``` js -var sqlite3 = require('sqlite3').verbose(); -var db = new sqlite3.Database(':memory:'); +const sqlite3 = require('sqlite3').verbose(); +const db = new sqlite3.Database(':memory:'); -db.serialize(function() { - db.run("CREATE TABLE lorem (info TEXT)"); +db.serialize(() => { + db.run("CREATE TABLE lorem (info TEXT)"); - var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); - for (var i = 0; i < 10; i++) { - stmt.run("Ipsum " + i); - } - stmt.finalize(); + const stmt = db.prepare("INSERT INTO lorem VALUES (?)"); + for (let i = 0; i < 10; i++) { + stmt.run("Ipsum " + i); + } + stmt.finalize(); - db.each("SELECT rowid AS id, info FROM lorem", function(err, row) { - console.log(row.id + ": " + row.info); - }); + db.each("SELECT rowid AS id, info FROM lorem", (err, row) => { + console.log(row.id + ": " + row.info); + }); }); db.close();