# organic-dna-resolve

> Shotgun for resolving DNA values

Latest version **1.2.0** (published 2021-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install organic-dna-resolve
pnpm add organic-dna-resolve
yarn add organic-dna-resolve
bun add organic-dna-resolve
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-12-07 |
| First published | 2015-12-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | multi |
| Maintainers | outbounder, multi |

## Links

- npm: https://www.npmjs.com/package/organic-dna-resolve
- Repository: https://github.com/camplight/organic-dna-resolve
- Issues: https://github.com/camplight/organic-dna-resolve/issues
- npm.io page: https://npm.io/package/organic-dna-resolve

## Dependencies (2)

- [clone](https://npm.io/package/clone.md) ^2.1.2
- [organic-dna-branches](https://npm.io/package/organic-dna-branches.md) ^1.0.0

## Recent versions

- 1.2.0 (latest) — 2021-12-07
- 1.1.2 — 2021-12-06
- 1.1.1 — 2019-07-13
- 1.1.0 — 2019-07-05
- 1.0.1 — 2019-03-30
- 1.0.0 — 2017-11-21
- 0.2.1 — 2017-02-10
- 0.2.0 — 2016-10-25
- 0.1.0 — 2016-10-21
- 0.0.3 — 2016-01-18
- 0.0.2 — 2015-12-14
- 0.0.1 — 2015-12-03

## README

# organic-dna-resolve

'Shotgun' for resolving DNA values

Works with:
- `@branch[.property]` direct references
- `!@branch[.property]` clone referenced branch/property
- `{$ENV_VAR}` reference process.env variables
- `&{property}` reference a property from the current (container) branch
- `"@{branch[.property]}"` in place reference
- `%branch.path(variableName=variableValue, anotherName=another value)`

## example

### given

```
var dna = {
  "branchSource": {
    "child-branchSrouce": {
      "property": 42
    }
  },
  "templateSource": {
    "template": true,
    "property-<=variable1=>": "having <=variable1=>"
  },
  "branch": {
    "child-branch": {
      "array": [
        {"@": "branchSrouce"},
        {"!@": "branchSrouce.child-branchSrouce"},
        "@branchSrouce.child-branchSrouce.property",
        "value with @{branchSrouce.child-branchSrouce.property}",
        "%templateSource(variable1=value1)"
      ],
      "child-branch-key": "value {$ENV_VAR}"
    },
    "branch-key": "&{child-branch.child-branch-key}"
  }
}

process.env.ENV_VAR = 'test'

require('organic-dna-resolve')(dna)

console.log(JSON.stringify(dna, null, 2))
```

### outputs

```
{
  "branchSource": {
    "child-branchSource": {
      "property": 42
    }
  },
  "templateSource": {
    "template": true,
    "property-<=variable1=>": "having <=variable1=>"
  },
  "branch": {
    "child-branch": {
      "array": [
        {
          "child-branchSource": {
            "property": 42
          }
        },
        {
          "property": 42
        },
        42,
        "value with 42",
        {
          "template": true,
          "property-value1": "having value1"
        }
      ],
      "child-branch-key": "value test"
    },
    "branch-key": "value test"
  }
}
```

More examples can be found in tests folder

---
_Source: https://npm.io/package/organic-dna-resolve · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
