dbcopycat
Version:
A JSON Database that saves your Json data in a file and makes it easy for you to perform CRUD operations.
13 lines (11 loc) • 382 B
JavaScript
const log = require("../utils/log");
const getAllData = require("./getAllData")
function dataFind(arrayName, condition) {
const dataAll = getAllData();
if (dataAll[arrayName] == undefined) {
log(`${arrayName} array not found.`, "Error", "error");
return undefined
}
return dataAll[arrayName].find(condition)
}
module.exports = dataFind;