How to use flattenjs - 1 common examples

To help you get started, we’ve selected a few flattenjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fega / mongo-server / lib / index.js View on Github external
exports.getFilters = (filters = {}) => {
  const filtersWithoutFLags = omitBy(filters, (_, key) => isFlag(key));
  const flat = Object.keys(flattenObject.convert(filtersWithoutFLags));

  if (flat.some(v => v.includes('$'))) throw new HttpError.BadRequest('unsafe query parameter');

  const filterParsed = reduce(filtersWithoutFLags, filterParserReducer, {});
  return filterParsed;
};

flattenjs

A small simple library to easily flatten / unflatten JSON objects. Uses square brackets in path to preserve arrays.

ISC
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular flattenjs functions

Similar packages