@customcommander/parsley

[![Build Status](https://travis-ci.org/customcommander/parsley.svg?branch=master)](https://travis-ci.org/customcommander/parsley)

Stats

StarsIssuesVersionUpdatedCreatedSize
@customcommander/parsley
002.0.04 years ago4 years agoMinified + gzip package size for @customcommander/parsley in KB

Readme

parsley

Build Status

Parses an object and replaces tokens with values from that object

npm install @customcommander/parsley
const parsley = require('@customcommander/parsley');
const config = {
  tld: 'com',
  host: 'example.[[tld]]',
  api: {
    version: '1.0',
    path: 'https://[[host]]/api/[[api.version]]'
  },
  dev: {
    tld: 'dev',
    api: {
      version: '[[api.version]]-alpha'
    }
  }
};

parsley(config);
// {
//   tld: 'com',
//   host: 'example.com',
//   api: {
//     version: '1.0',
//     path: 'https://example.com/api/1.0'
//   },
//   dev: {
//     tld: 'dev',
//     api: {
//       version: '1.0-alpha'
//     }
//   }
// }

parsley(config, 'dev');
// {
//   tld: 'dev',
//   host: 'example.dev',
//   api: {
//     version: '1.0-alpha',
//     path: 'https://example.dev/api/1.0-alpha'
//   },
//   dev: {
//     tld: 'dev',
//     api: {
//       version: '1.0-alpha'
//     }
//   }
// }

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.