1.2.1 • Published 6 years ago

dot-get-set v1.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

dot-get-set

Flexible filesystem accessor for text and JSON

FeatureBuilt With
Concurrent file accessproper-lockfile
File globnode-glob
Fuzzy immutable "dot" accessorcamel-dot-prop-immutable

Example

FileContents
hello.txtworld
lorem/ipsum/dolor.json{ sit: "amet" }
test.jsSee 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.

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago