Welcome to mirror list, hosted at ThFree Co, Russian Federation.

obj-filter.js « lib « yargs « node_modules - github.com/austingebauer/devise.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 42cb9961eefd2a2ec18b7f1e9820be10d8d72c66 (plain)
1
2
3
4
5
6
7
8
9
10
module.exports = function (original, filter) {
  const obj = {}
  filter = filter || function (k, v) { return true }
  Object.keys(original || {}).forEach(function (key) {
    if (filter(key, original[key])) {
      obj[key] = original[key]
    }
  })
  return obj
}