JSPM

  • Created
  • Published
  • Downloads 981
  • Score
    100M100P100Q108323F
  • License MIT

Merge and flatten any arrays found in all values within plain objects

Package Exports

  • object-flatten-all-arrays

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-flatten-all-arrays) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

object-flatten-all-arrays

Merge and flatten any arrays found in all values within plain objects

Install

npm i object-flatten-all-arrays

Quick Take

import { strict as assert } from "assert";
import flattenAllArrays from "object-flatten-all-arrays";

assert.deepEqual(
  flattenAllArrays({
    a: "a",
    b: "b",
    c: [
      {
        b: "b",
        a: "a",
      },
      {
        d: "d",
        c: "c",
      },
    ],
  }),
  {
    a: "a",
    b: "b",
    c: [
      {
        a: "a",
        b: "b",
        c: "c",
        d: "d",
      },
    ],
  }
);

Documentation

Please visit codsen.com for a full description of the API and examples.

Licence

MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors

ok codsen star