dot-mustache

1.0.16 • Public • Published

DotMustache

Allows you to access arrays and objects via dot notation.

const {parser} = require('dot-mustache');
parser('body.text.crit.[words,something.here]', {
  body: {
    text: [{
      crit: {
        words: ['This works', 'This too'],
        something: {
          here: 'here this works',
        },
      },
    }, {
      crit: [{
        words: 'still works',
        something: {
          here: 'here this works too',
        },
      }],
    }],
  },
});

This code snippet returns

[{
  'words': ['This works', 'This too'],
  'something.here': 'here this works'
} {
  'words': 'still works',
  'something.here': 'here this works too'
}]

/dot-mustache/

    Package Sidebar

    Install

    npm i dot-mustache

    Weekly Downloads

    23

    Version

    1.0.16

    License

    MIT

    Last publish

    Collaborators

    • ilanetnamar