0.0.1 • Published 10 years ago

organic-dna-resolveclones v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

organic-dna-resolveclones

Resolves DNA !@branch.property values by cloning the referenced branches

example

var dna = {
  "branch": {
    "property": "value"
  },
  "otherBranch": {
    "propertyValueReference": "!@branch.property",
    "wholeBranch": "!@branch"
  }
}

var resolveClones = require("organic-dna-resolveclones")
resolveClones(dna)

dna.branch.property = "new value"

console.log(dna.otherBranch.propertyValueReference) // == "value"
console.log(dna.otherBranch.wholeBranch.property) // == "value"
console.log(dna.branch.property) // == "new value"