UNPKG

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) 388 B
const log = require("../utils/log"); const getAllData = require("./getAllData") function dataFilter(arrayName, condition) { const dataAll = getAllData(); if (dataAll[arrayName] == undefined) { log(`${arrayName} array not found.`, "Error", "error"); return undefined } return dataAll[arrayName].filter(condition) } module.exports = dataFilter;