MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / rowFactory

Function rowFactory

lib/database.js:105–116  ·  view source on GitHub ↗
(...keys)

Source from the content-addressed store, hash-verified

103}
104
105function rowFactory(...keys) {
106 if (!keys.includes('__proto__')) {
107 const parameters = keys.map((_, index) => `v${index}`).join(',');
108 const properties = keys.map((key, index) => `${JSON.stringify(key)}:v${index}`).join(',');
109 return Function(`return (${parameters}) => ({${properties}})`)();
110 }
111 return (...values) => {
112 const row = {};
113 for (let i = 0; i < keys.length; ++i) row[keys[i]] = values[i];
114 return row;
115 };
116}
117
118function recordFactory(value) {
119 return { value, done: false };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected