function Backup() { [native code] }n/a
function Database() { [native code] }...
let db;
let sqlite3;
sqlite3 = (
globalThis.utility2_rollup
|| globalThis.utility2_jslint
|| require("sqlite3-lite")
);
db = new sqlite3.Database(":memory:");
db.serialize(function () {
let ii;
let stmt;
db.run("CREATE TABLE lorem (info TEXT)");
stmt = db.prepare("INSERT INTO lorem VALUES (?)");
ii = 0;
while (ii < 10) {
...function Statement() { [native code] }n/a
function assertJsonEqual(aa, bb) {
/*
* this function will assert JSON.stringify(<aa>) === JSON.stringify(<bb>)
*/
function objectDeepCopyWithKeysSorted(obj) {
/*
* this function will recursively deep-copy <obj> with keys sorted
*/
let sorted;
if (typeof obj !== "object" || !obj) {
return obj;
}
// recursively deep-copy list with child-keys sorted
if (Array.isArray(obj)) {
return obj.map(objectDeepCopyWithKeysSorted);
}
// recursively deep-copy obj with keys sorted
sorted = {};
Object.keys(obj).sort().forEach(function (key) {
sorted[key] = objectDeepCopyWithKeysSorted(obj[key]);
});
return sorted;
}
aa = JSON.stringify(objectDeepCopyWithKeysSorted(aa));
bb = JSON.stringify(objectDeepCopyWithKeysSorted(bb));
if (aa !== bb) {
throw new Error(JSON.stringify(aa) + " !== " + JSON.stringify(bb));
}
}n/a
function assertOrThrow(passed, msg) {
/*
* this function will throw <msg> if <passed> is falsy
*/
if (passed) {
return;
}
throw (
(
msg
&& typeof msg.message === "string"
&& typeof msg.stack === "string"
)
// if msg is err, then leave as is
? msg
: new Error(
typeof msg === "string"
// if msg is string, then leave as is
? msg
// else JSON.stringify(msg)
: JSON.stringify(msg, undefined, 4)
)
);
}n/a
function coalesce(...argList) {
/*
* this function will coalesce null, undefined, or "" in <argList>
*/
let arg;
let ii;
ii = 0;
while (ii < argList.length) {
arg = argList[ii];
if (arg !== undefined && arg !== null && arg !== "") {
return arg;
}
ii += 1;
}
return arg;
}n/a
function identity(val) {
/*
* this function will return <val>
*/
return val;
}n/a
function nop() {
/*
* this function will do nothing
*/
return;
}n/a
function objectAssignDefault(tgt = {}, src = {}, depth = 0) {
/*
* this function will if items from <tgt> are null, undefined, or "",
* then overwrite them with items from <src>
*/
let recurse;
recurse = function (tgt, src, depth) {
Object.entries(src).forEach(function ([
key, bb
]) {
let aa;
aa = tgt[key];
if (aa === undefined || aa === null || aa === "") {
tgt[key] = bb;
return;
}
if (
depth !== 0
&& typeof aa === "object" && aa && !Array.isArray(aa)
&& typeof bb === "object" && bb && !Array.isArray(bb)
) {
recurse(aa, bb, depth - 1);
}
});
};
recurse(tgt, src, depth | 0);
return tgt;
}n/a
function onErrorThrow(err) {
/*
* this function will throw <err> if exists
*/
if (err) {
throw err;
}
}n/a
function() {
if (!isVerbose) {
// hack-sqlite3 - require module
var trace = exports_mapbox_node_sqlite3_lib_trace;
[
'prepare',
'get',
'run',
'all',
'each',
'map',
'close',
'exec'
].forEach(function (name) {
trace.extendTrace(Database.prototype, name);
});
[
'bind',
'get',
'run',
'all',
'each',
'map',
'reset',
'finalize',
].forEach(function (name) {
trace.extendTrace(Statement.prototype, name);
});
isVerbose = true;
}
return this;
}n/a
function Backup() { [native code] }n/a
function addListener(type, listener) {
return _addListener(this, type, listener, false);
}n/a
function(...args) {
const domain = this.domain;
const type = args[0];
const shouldEmitError = type === 'error' &&
this.listenerCount(type) > 0;
// Just call original `emit` if current EE instance has `error`
// handler, there's no active domain or this is process
if (shouldEmitError || domain === null || domain === undefined ||
this === process) {
return ReflectApply(eventEmit, this, args);
}
if (type === 'error') {
const er = args.length > 1 && args[1] ?
args[1] : new ERR_UNHANDLED_ERROR();
if (typeof er === 'object') {
er.domainEmitter = this;
ObjectDefineProperty(er, 'domain', {
configurable: true,
enumerable: false,
value: domain,
writable: true
});
er.domainThrown = false;
}
// Remove the current domain (and its duplicates) from the domains stack and
// set the active domain to its parent (if any) so that the domain's error
// handler doesn't run in its own context. This prevents any event emitter
// created or any exception thrown in that error handler from recursively
// executing that error handler.
const origDomainsStack = stack.slice();
const origActiveDomain = process.domain;
// Travel the domains stack from top to bottom to find the first domain
// instance that is not a duplicate of the current active domain.
let idx = stack.length - 1;
while (idx > -1 && process.domain === stack[idx]) {
--idx;
}
// Change the stack to not contain the current active domain, and only the
// domains above it on the stack.
if (idx < 0) {
stack.length = 0;
} else {
stack.splice(idx + 1);
}
// Change the current active domain
if (stack.length > 0) {
exports.active = process.domain = stack[stack.length - 1];
} else {
exports.active = process.domain = null;
}
updateExceptionCapture();
domain.emit('error', er);
// Now that the domain's error handler has completed, restore the domains
// stack and the active domain to their original values.
exports._stack = stack = origDomainsStack;
exports.active = process.domain = origActiveDomain;
updateExceptionCapture();
return false;
}
domain.enter();
const ret = ReflectApply(eventEmit, this, args);
domain.exit();
return ret;
}n/a
function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
}n/a
function getMaxListeners() {
return _getMaxListeners(this);
}n/a
function listenerCount(type) {
const events = this._events;
if (events !== undefined) {
const evlistener = events[type];
if (typeof evlistener === 'function') {
return 1;
} else if (evlistener !== undefined) {
return evlistener.length;
}
}
return 0;
}n/a
function listeners(type) {
return _listeners(this, type, true);
}n/a
function removeListener(type, listener) {
checkListener(listener);
const events = this._events;
if (events === undefined)
return this;
const list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
let position = -1;
for (let i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
if (spliceOne === undefined)
spliceOne = require('internal/util').spliceOne;
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, listener);
}
return this;
}n/a
function addListener(type, listener) {
return _addListener(this, type, listener, false);
}...
// bug-workaround - throw unhandledRejections in node-process
if (
typeof process === "object" && process
&& typeof process.on === "function"
&& process.unhandledRejections !== "strict"
) {
process.unhandledRejections = "strict";
process.on("unhandledRejection", function (err) {
throw err;
});
}
// init local
local = {};
local.local = local;
globalThis.globalLocal = local;
...function once(type, listener) {
checkListener(listener);
this.on(type, _onceWrap(this, type, listener));
return this;
}...
}
else {
// Make sure the callback is called.
db = sqlite3.cached.objects[file];
var callback = (typeof a === 'number') ? b : a;
if (typeof callback === 'function') {
if (db.open) process.nextTick(cb);
else db.once('open', cb);
}
}
return db;
},
objects: {}
};
...function prependListener(type, listener) {
return _addListener(this, type, listener, true);
}n/a
function prependOnceListener(type, listener) {
checkListener(listener);
this.prependListener(type, _onceWrap(this, type, listener));
return this;
}n/a
function rawListeners(type) {
return _listeners(this, type, false);
}n/a
function removeAllListeners(type) {
const events = this._events;
if (events === undefined)
return this;
// Not listening for removeListener, no need to emit
if (events.removeListener === undefined) {
if (arguments.length === 0) {
this._events = ObjectCreate(null);
this._eventsCount = 0;
} else if (events[type] !== undefined) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else
delete events[type];
}
return this;
}
// Emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (const key of ReflectOwnKeys(events)) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = ObjectCreate(null);
this._eventsCount = 0;
return this;
}
const listeners = events[type];
if (typeof listeners === 'function') {
this.removeListener(type, listeners);
} else if (listeners !== undefined) {
// LIFO order
for (let i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type, listeners[i]);
}
}
return this;
}n/a
function removeListener(type, listener) {
checkListener(listener);
const events = this._events;
if (events === undefined)
return this;
const list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
let position = -1;
for (let i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
if (spliceOne === undefined)
spliceOne = require('internal/util').spliceOne;
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, listener);
}
return this;
}n/a
function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
throw new ERR_OUT_OF_RANGE('n', 'a non-negative number', n);
}
this._maxListeners = n;
return this;
}n/a
function Database() { [native code] }...
let db;
let sqlite3;
sqlite3 = (
globalThis.utility2_rollup
|| globalThis.utility2_jslint
|| require("sqlite3-lite")
);
db = new sqlite3.Database(":memory:");
db.serialize(function () {
let ii;
let stmt;
db.run("CREATE TABLE lorem (info TEXT)");
stmt = db.prepare("INSERT INTO lorem VALUES (?)");
ii = 0;
while (ii < 10) {
...function(type) {
var val = EventEmitter.prototype.addListener.apply(this, arguments);
if (supportedEvents.indexOf(type) >= 0) {
this.configure(type, true);
}
return val;
}n/a
all = function (sql) {
var errBack;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof args[args.length - 1] === 'function') {
var callback = args[args.length - 1];
errBack = function(err) {
if (err) {
callback(err);
}
};
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
}n/a
function() {
var backup;
if (arguments.length <= 2) {
// By default, we write the main database out to the main database of the named file.
// This is the most likely use of the backup api.
backup = new Backup(this, arguments[0], 'main', 'main', true, arguments[1]);
} else {
// Otherwise, give the user full control over the sqlite3_backup_init arguments.
backup = new Backup(this, arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
}
// Per the sqlite docs, exclude the following errors as non-fatal by default.
backup.retryErrors = [sqlite3.BUSY, sqlite3.LOCKED];
return backup;
}n/a
each = function (sql) {
var errBack;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof args[args.length - 1] === 'function') {
var callback = args[args.length - 1];
errBack = function(err) {
if (err) {
callback(err);
}
};
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
}...
stmt = db.prepare("INSERT INTO lorem VALUES (?)");
ii = 0;
while (ii < 10) {
stmt.run("Ipsum " + ii);
ii += 1;
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", function (err, row) {
if (err) {
throw err;
}
console.log(row.id + ": " + row.info);
});
});
db.close();
...function(...args) {
const domain = this.domain;
const type = args[0];
const shouldEmitError = type === 'error' &&
this.listenerCount(type) > 0;
// Just call original `emit` if current EE instance has `error`
// handler, there's no active domain or this is process
if (shouldEmitError || domain === null || domain === undefined ||
this === process) {
return ReflectApply(eventEmit, this, args);
}
if (type === 'error') {
const er = args.length > 1 && args[1] ?
args[1] : new ERR_UNHANDLED_ERROR();
if (typeof er === 'object') {
er.domainEmitter = this;
ObjectDefineProperty(er, 'domain', {
configurable: true,
enumerable: false,
value: domain,
writable: true
});
er.domainThrown = false;
}
// Remove the current domain (and its duplicates) from the domains stack and
// set the active domain to its parent (if any) so that the domain's error
// handler doesn't run in its own context. This prevents any event emitter
// created or any exception thrown in that error handler from recursively
// executing that error handler.
const origDomainsStack = stack.slice();
const origActiveDomain = process.domain;
// Travel the domains stack from top to bottom to find the first domain
// instance that is not a duplicate of the current active domain.
let idx = stack.length - 1;
while (idx > -1 && process.domain === stack[idx]) {
--idx;
}
// Change the stack to not contain the current active domain, and only the
// domains above it on the stack.
if (idx < 0) {
stack.length = 0;
} else {
stack.splice(idx + 1);
}
// Change the current active domain
if (stack.length > 0) {
exports.active = process.domain = stack[stack.length - 1];
} else {
exports.active = process.domain = null;
}
updateExceptionCapture();
domain.emit('error', er);
// Now that the domain's error handler has completed, restore the domains
// stack and the active domain to their original values.
exports._stack = stack = origDomainsStack;
exports.active = process.domain = origActiveDomain;
updateExceptionCapture();
return false;
}
domain.enter();
const ret = ReflectApply(eventEmit, this, args);
domain.exit();
return ret;
}n/a
function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
}n/a
get = function (sql) {
var errBack;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof args[args.length - 1] === 'function') {
var callback = args[args.length - 1];
errBack = function(err) {
if (err) {
callback(err);
}
};
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
}n/a
function getMaxListeners() {
return _getMaxListeners(this);
}n/a
function listenerCount(type) {
const events = this._events;
if (events !== undefined) {
const evlistener = events[type];
if (typeof evlistener === 'function') {
return 1;
} else if (evlistener !== undefined) {
return evlistener.length;
}
}
return 0;
}n/a
function listeners(type) {
return _listeners(this, type, true);
}n/a
map = function (sql) {
var errBack;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof args[args.length - 1] === 'function') {
var callback = args[args.length - 1];
errBack = function(err) {
if (err) {
callback(err);
}
};
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
}...
*/
let sorted;
if (typeof obj !== "object" || !obj) {
return obj;
}
// recursively deep-copy list with child-keys sorted
if (Array.isArray(obj)) {
return obj.map(objectDeepCopyWithKeysSorted);
}
// recursively deep-copy obj with keys sorted
sorted = {};
Object.keys(obj).sort().forEach(function (key) {
sorted[key] = objectDeepCopyWithKeysSorted(obj[key]);
});
return sorted;
...function removeListener(type, listener) {
checkListener(listener);
const events = this._events;
if (events === undefined)
return this;
const list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
let position = -1;
for (let i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
if (spliceOne === undefined)
spliceOne = require('internal/util').spliceOne;
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, listener);
}
return this;
}n/a
function(type) {
var val = EventEmitter.prototype.addListener.apply(this, arguments);
if (supportedEvents.indexOf(type) >= 0) {
this.configure(type, true);
}
return val;
}...
// bug-workaround - throw unhandledRejections in node-process
if (
typeof process === "object" && process
&& typeof process.on === "function"
&& process.unhandledRejections !== "strict"
) {
process.unhandledRejections = "strict";
process.on("unhandledRejection", function (err) {
throw err;
});
}
// init local
local = {};
local.local = local;
globalThis.globalLocal = local;
...function once(type, listener) {
checkListener(listener);
this.on(type, _onceWrap(this, type, listener));
return this;
}...
}
else {
// Make sure the callback is called.
db = sqlite3.cached.objects[file];
var callback = (typeof a === 'number') ? b : a;
if (typeof callback === 'function') {
if (db.open) process.nextTick(cb);
else db.once('open', cb);
}
}
return db;
},
objects: {}
};
...prepare = function (sql) {
var errBack;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof args[args.length - 1] === 'function') {
var callback = args[args.length - 1];
errBack = function(err) {
if (err) {
callback(err);
}
};
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
}...
|| require("sqlite3-lite")
);
db = new sqlite3.Database(":memory:");
db.serialize(function () {
let ii;
let stmt;
db.run("CREATE TABLE lorem (info TEXT)");
stmt = db.prepare("INSERT INTO lorem VALUES (?)");
ii = 0;
while (ii < 10) {
stmt.run("Ipsum " + ii);
ii += 1;
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", function (err, row) {
...function prependListener(type, listener) {
return _addListener(this, type, listener, true);
}n/a
function prependOnceListener(type, listener) {
checkListener(listener);
this.prependListener(type, _onceWrap(this, type, listener));
return this;
}n/a
function rawListeners(type) {
return _listeners(this, type, false);
}n/a
function(type) {
var val = EventEmitter.prototype.removeAllListeners.apply(this, arguments);
if (supportedEvents.indexOf(type) >= 0) {
this.configure(type, false);
}
return val;
}n/a
function(type) {
var val = EventEmitter.prototype.removeListener.apply(this, arguments);
if (supportedEvents.indexOf(type) >= 0 && !this._events[type]) {
this.configure(type, false);
}
return val;
}n/a
run = function (sql) {
var errBack;
var args = Array.prototype.slice.call(arguments, 1);
if (typeof args[args.length - 1] === 'function') {
var callback = args[args.length - 1];
errBack = function(err) {
if (err) {
callback(err);
}
};
}
var statement = new Statement(this, sql, errBack);
return fn.call(this, statement, args);
}...
|| globalThis.utility2_jslint
|| require("sqlite3-lite")
);
db = new sqlite3.Database(":memory:");
db.serialize(function () {
let ii;
let stmt;
db.run("CREATE TABLE lorem (info TEXT)");
stmt = db.prepare("INSERT INTO lorem VALUES (?)");
ii = 0;
while (ii < 10) {
stmt.run("Ipsum " + ii);
ii += 1;
}
stmt.finalize();
...function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
throw new ERR_OUT_OF_RANGE('n', 'a non-negative number', n);
}
this._maxListeners = n;
return this;
}n/a
function Statement() { [native code] }n/a
function addListener(type, listener) {
return _addListener(this, type, listener, false);
}n/a
function(...args) {
const domain = this.domain;
const type = args[0];
const shouldEmitError = type === 'error' &&
this.listenerCount(type) > 0;
// Just call original `emit` if current EE instance has `error`
// handler, there's no active domain or this is process
if (shouldEmitError || domain === null || domain === undefined ||
this === process) {
return ReflectApply(eventEmit, this, args);
}
if (type === 'error') {
const er = args.length > 1 && args[1] ?
args[1] : new ERR_UNHANDLED_ERROR();
if (typeof er === 'object') {
er.domainEmitter = this;
ObjectDefineProperty(er, 'domain', {
configurable: true,
enumerable: false,
value: domain,
writable: true
});
er.domainThrown = false;
}
// Remove the current domain (and its duplicates) from the domains stack and
// set the active domain to its parent (if any) so that the domain's error
// handler doesn't run in its own context. This prevents any event emitter
// created or any exception thrown in that error handler from recursively
// executing that error handler.
const origDomainsStack = stack.slice();
const origActiveDomain = process.domain;
// Travel the domains stack from top to bottom to find the first domain
// instance that is not a duplicate of the current active domain.
let idx = stack.length - 1;
while (idx > -1 && process.domain === stack[idx]) {
--idx;
}
// Change the stack to not contain the current active domain, and only the
// domains above it on the stack.
if (idx < 0) {
stack.length = 0;
} else {
stack.splice(idx + 1);
}
// Change the current active domain
if (stack.length > 0) {
exports.active = process.domain = stack[stack.length - 1];
} else {
exports.active = process.domain = null;
}
updateExceptionCapture();
domain.emit('error', er);
// Now that the domain's error handler has completed, restore the domains
// stack and the active domain to their original values.
exports._stack = stack = origDomainsStack;
exports.active = process.domain = origActiveDomain;
updateExceptionCapture();
return false;
}
domain.enter();
const ret = ReflectApply(eventEmit, this, args);
domain.exit();
return ret;
}n/a
function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
}n/a
function getMaxListeners() {
return _getMaxListeners(this);
}n/a
function listenerCount(type) {
const events = this._events;
if (events !== undefined) {
const evlistener = events[type];
if (typeof evlistener === 'function') {
return 1;
} else if (evlistener !== undefined) {
return evlistener.length;
}
}
return 0;
}n/a
function listeners(type) {
return _listeners(this, type, true);
}n/a
function() {
var params = Array.prototype.slice.call(arguments);
var callback = params.pop();
params.push(function(err, rows) {
if (err) return callback(err);
var result = {};
if (rows.length) {
var keys = Object.keys(rows[0]), key = keys[0];
if (keys.length > 2) {
// Value is an object
for (var i = 0; i < rows.length; i++) {
result[rows[i][key]] = rows[i];
}
} else {
var value = keys[1];
// Value is a plain value
for (i = 0; i < rows.length; i++) {
result[rows[i][key]] = rows[i][value];
}
}
}
callback(err, result);
});
return this.all.apply(this, params);
}...
*/
let sorted;
if (typeof obj !== "object" || !obj) {
return obj;
}
// recursively deep-copy list with child-keys sorted
if (Array.isArray(obj)) {
return obj.map(objectDeepCopyWithKeysSorted);
}
// recursively deep-copy obj with keys sorted
sorted = {};
Object.keys(obj).sort().forEach(function (key) {
sorted[key] = objectDeepCopyWithKeysSorted(obj[key]);
});
return sorted;
...function removeListener(type, listener) {
checkListener(listener);
const events = this._events;
if (events === undefined)
return this;
const list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
let position = -1;
for (let i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
if (spliceOne === undefined)
spliceOne = require('internal/util').spliceOne;
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, listener);
}
return this;
}n/a
function addListener(type, listener) {
return _addListener(this, type, listener, false);
}...
// bug-workaround - throw unhandledRejections in node-process
if (
typeof process === "object" && process
&& typeof process.on === "function"
&& process.unhandledRejections !== "strict"
) {
process.unhandledRejections = "strict";
process.on("unhandledRejection", function (err) {
throw err;
});
}
// init local
local = {};
local.local = local;
globalThis.globalLocal = local;
...function once(type, listener) {
checkListener(listener);
this.on(type, _onceWrap(this, type, listener));
return this;
}...
}
else {
// Make sure the callback is called.
db = sqlite3.cached.objects[file];
var callback = (typeof a === 'number') ? b : a;
if (typeof callback === 'function') {
if (db.open) process.nextTick(cb);
else db.once('open', cb);
}
}
return db;
},
objects: {}
};
...function prependListener(type, listener) {
return _addListener(this, type, listener, true);
}n/a
function prependOnceListener(type, listener) {
checkListener(listener);
this.prependListener(type, _onceWrap(this, type, listener));
return this;
}n/a
function rawListeners(type) {
return _listeners(this, type, false);
}n/a
function removeAllListeners(type) {
const events = this._events;
if (events === undefined)
return this;
// Not listening for removeListener, no need to emit
if (events.removeListener === undefined) {
if (arguments.length === 0) {
this._events = ObjectCreate(null);
this._eventsCount = 0;
} else if (events[type] !== undefined) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else
delete events[type];
}
return this;
}
// Emit removeListener for all listeners on all events
if (arguments.length === 0) {
for (const key of ReflectOwnKeys(events)) {
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = ObjectCreate(null);
this._eventsCount = 0;
return this;
}
const listeners = events[type];
if (typeof listeners === 'function') {
this.removeListener(type, listeners);
} else if (listeners !== undefined) {
// LIFO order
for (let i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type, listeners[i]);
}
}
return this;
}n/a
function removeListener(type, listener) {
checkListener(listener);
const events = this._events;
if (events === undefined)
return this;
const list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = ObjectCreate(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
let position = -1;
for (let i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
if (spliceOne === undefined)
spliceOne = require('internal/util').spliceOne;
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, listener);
}
return this;
}n/a
function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
throw new ERR_OUT_OF_RANGE('n', 'a non-negative number', n);
}
this._maxListeners = n;
return this;
}n/a
function(file, a, b) {
if (file === '' || file === ':memory:') {
// Don't cache special databases.
return new Database(file, a, b);
}
var db;
file = path.resolve(file);
function cb() { callback.call(db, null); }
if (!sqlite3.cached.objects[file]) {
db = sqlite3.cached.objects[file] = new Database(file, a, b);
}
else {
// Make sure the callback is called.
db = sqlite3.cached.objects[file];
var callback = (typeof a === 'number') ? b : a;
if (typeof callback === 'function') {
if (db.open) process.nextTick(cb);
else db.once('open', cb);
}
}
return db;
}...
let db;
let sqlite3;
sqlite3 = (
globalThis.utility2_rollup
|| globalThis.utility2_jslint
|| require("sqlite3-lite")
);
db = new sqlite3.Database(":memory:");
db.serialize(function () {
let ii;
let stmt;
db.run("CREATE TABLE lorem (info TEXT)");
stmt = db.prepare("INSERT INTO lorem VALUES (?)");
ii = 0;
while (ii < 10) {
...