This package has been deprecated

Author message:

Just implement the two lines of code yourself.

yaml-to-object-path-record
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

yaml-to-object-path-record

NPM Version node Build Status Dependency Status Dev Dependency Status

Parses yaml into a Record<string, string> with object paths as key

This is often useful when having translation files in yaml and access them by object path. For example this is used in telegraf-i18n.

The name of the package is inspired by the TypeScript type Record<Key, Value> as thats the structure of the result. An object path is the path in dot notation needed to uniquely identify a key within the object. For example {some: {deep: {object: {structure: 'value'}}}} would have some.deep.object.structure as object path.

Install

$ npm install yaml-to-object-path-record

Usage

const yamlToObjectPathRecord = require('yaml-to-object-path-record');
 
const yamlString = `
foo: bar
some: value
something:
    deep: 'is a path'
    else: 'also works'
`;
 
yamlToObjectPathRecord('unicorns');
//=> {foo: 'bar', some: 'value', 'something.deep': 'is a path', 'something.else': 'also works'}

Package Sidebar

Install

npm i yaml-to-object-path-record

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

5.08 kB

Total Files

5

Last publish

Collaborators

  • edjopato