JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 950
  • Score
    100M100P100Q100173F

Normalize config formats, expand globbing/minimatch patterns and read-in JSON/YAML data files.

Package Exports

  • plasma

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (plasma) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

plasma NPM version

Normalize config formats, expand globbing/minimatch patterns and read-in JSON/YAML data files.

npm i plasma --save

Usage

var plasma = require('plasma');

plasma.find({src: ['*.json']});

API

.find( options )

If an object with a src property is passed in, plasma will attempt to expand any glob/minimatch patterns into an array of resolved filepaths.

.normalize( config )

Normalize config formats for source files, so that any of the following will work:

  • {src: ''}
  • {data: {src: ''}}
  • {data: [{src: ''}, {src: ''}]}

Returns an object with two properties:

  • raw: array of objects that do not have src properties will be pushed into the raw property so that globule doesn't try to search for filepaths when they don't exist.
  • data: array of objects with src properties, each of which is an array of filepaths or un-expanded glob patterns.

.expand( options )

Process patterns in the src properties of objects passed from plasma.normalize(). Uses plasma.find() to expand each src property into an array of resolved filepaths.

.load( config, options )

Actually read-in data from src files.

.coerce( config, options )

Manipulate the final output into either an array of objects, or an object of objects.

Tests

Until mocha tests are implemented, run node test/test.

Acknowlegement

node-configfiles by Tyler Kellen influenced some of the code in this lib, especially the approach for normalizing config formats. Thanks, Tyler!

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license