organic-dna-cells-info

3.0.1 • Public • Published

organic-dna-cells-info

extract cells info from dna branch based on cellInfo: v1 schema

usage

// given dna branch

const dnaBranch = {
  'apis': {
    'v1': {
      'name': 'legacy-v1',
      'cellKind': 'test',
      'cellInfo': 'v1'
    },
    'v2': {
      'cellKind': 'test',
      'cellInfo': 'v1'
    },
    'cellKind': 'test',
    'cellInfo': 'v1'
  },
  'webapps': {
    '2018': {
      'client': {
        'cellKind': 'test',
        'cellInfo': 'v1'
      }
    }
  },
  'supervisor': {
    'cellKind': 'test',
    'cellInfo': 'v1'
  }
}

const {getAllCells, getCell} = require('organic-dna-cells-info')
console.log(getAllCells(dnaBranch)) // will print Array of CellInfo structures
console.log(getCell(dnaBranch, 'supervisor')) // will pring only supervisor CellInfo

CellInfo

{
  dna: DNA, // cell's dna
  name: String, // cell's name
  groups: Array[String], // cell's groups
  dnaBranchPath: String // dot notated dna branch path
}

CellInfo v1 schema

Cells to be found should follow the schema as their cell DNA:

{
  cellKind: String,
  cellInfo: "v1"
}

notes

Cells are deep searched within given dna branch structure:

  • cell's groups are formed by their (deep) nesting level path concatenated with their implicit groups or group values

Readme

Keywords

none

Package Sidebar

Install

npm i organic-dna-cells-info

Weekly Downloads

1

Version

3.0.1

License

MIT

Unpacked Size

6.76 kB

Total Files

7

Last publish

Collaborators

  • outbounder