JSPM

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

Flexible filesystem accessor for text and JSON

Package Exports

  • dot-get-set

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

Readme

dot-get-set

Flexible filesystem accessor for text and JSON

Feature Built With
Concurrent file access proper-lockfile
File glob node-glob
Fuzzy immutable "dot" accessor camel-dot-prop-immutable

Example

File Contents
hello.txt world
lorem/ipsum/dolor.json { sit: "amet" }
test.js See below
import getSet from "dot-get-set"
;(async () => {
  let config = await getSet(__dirname, "**/*")

  config.get("hello")
  // "world"

  config.get("lorem.ipsum.dolor.sit")
  // "amet"

  config = config.set("hello", "universe")
  // "universe" > hello.txt

  config.get("hello")
  // "universe"

  config = config.set("lorem.ipsum.dolor", { sed: "do" })
  // { sed: "do" } > lorem/ipsum/dolor.json

  config.get("lorem.ipsum.dolor")
  // { sed: "do" }
})()

Because the operation is immutable, config needs to be reassigned when mutated.