JSPM

tree-to-flat-map

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 748
  • Score
    100M100P100Q104072F
  • License MIT

Convert a tree to a flat map with dot-separated keys

Package Exports

  • tree-to-flat-map

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 (tree-to-flat-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tree-to-flat-map converts a tree to a flat map with dot-separated keys.

import { treeToFlatMap } from "tree-to-flat-map";

console.log(
  treeToFlatMap(
    {
      a: {
        b: {
          c: true,
        },
      },
      d: {
        e: 1,
      },
      f: "leaf",
    },
    { separator: "." }
  )
);
// {"a.b.c": true, "d.e": 1, "f": "leaf"}