From 1a4edc89401af42cc7bc340790d6a00d861a2cc4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 28 Feb 2024 11:42:48 -0300 Subject: src/utils.mjs: Replace promisify() by util.promisify() --- src/db.mjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/db.mjs') diff --git a/src/db.mjs b/src/db.mjs index b82cb18..7d6c6c5 100644 --- a/src/db.mjs +++ b/src/db.mjs @@ -3,6 +3,7 @@ import fs from "node:fs"; import path from "node:path"; import process from "node:process"; import url from "node:url"; +import util from "node:util"; import sqlite from "./sqlite.cjs"; @@ -12,9 +13,9 @@ import * as accretion from "./accretion.mjs"; export const promisifyDb = dbHandle => ({ ref: dbHandle, - all: u.promisify((...args) => dbHandle.all(...args)), - exec: u.promisify((...args) => dbHandle.exec(...args)), - run: u.promisify((...args) => dbHandle.run(...args)), + all: util.promisify((...args) => dbHandle.all(...args)), + exec: util.promisify((...args) => dbHandle.exec(...args)), + run: util.promisify((...args) => dbHandle.run(...args)), each: (...args) => new Promise((resolve, reject) => { const cb = args[args.length - 1]; @@ -28,8 +29,8 @@ export const promisifyDb = dbHandle => ({ new Promise((resolve, reject) => { const mkStmt = stmtRef => ({ ref: stmtRef, - run: u.promisify((...args) => stmtRef.run(...args)), - finalize: u.promisify((...args) => stmtRef.finalize(...args)), + run: util.promisify((...args) => stmtRef.run(...args)), + finalize: util.promisify((...args) => stmtRef.finalize(...args)), }); const ref = dbHandle.prepare( ...args, -- cgit v1.2.3