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

Function rowFactory

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

Source from the content-addressed store, hash-verified

92}
93
94function rowFactory(...keys) {
95 if (!keys.includes('__proto__')) {
96 const parameters = keys.map((_, index) => `v${index}`).join(',');
97 const properties = keys.map((key, index) => `${JSON.stringify(key)}:v${index}`).join(',');
98 return Function(`return (${parameters}) => ({${properties}})`)();
99 }
100 return (...values) => {
101 const row = {};
102 for (let i = 0; i < keys.length; ++i) row[keys[i]] = values[i];
103 return row;
104 };
105}
106
107function recordFactory(value) {
108 return { value, done: false };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected