JSPM

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

have any object you want

Package Exports

  • sourcegate

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 (sourcegate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sourcegate -- have any object you want

Use

NPM

Give it an array of paths to json files, or js objects. They will be deep-merged, left to right, using lodash.merge.

var sg = require('sourcegate');
var merged = sg(['initialize.json', 'customize/config.json', {c: 3}])

Configure

Sourcegate takes a second argument with the following default options:

{
  root: process.cwd(),
  relative: true,
  merge: true,
  write: {
    path: '', // a file name or path is required to enable writing it
    options: {},
    root: process.cwd(), // optional
    relative: true // optional
  },
  async: false // always the case so far...
}

If the root path is set, it can be relative (by default), or absolute.

Notice that merging is actually optional. That was added for the tests, though it could be useful elsewhere for simply loading files to memory.

The write is optional, enabled by write.path. The options are handed to node. The write.root and write.relative are same as the ones used for reading, unless they are explicitly made different.

Missing

Some day there may be an async implementation. Restated: this is made for gulp workflow beverage, and so far does not need async implementation. When it does, that would probably be promise-enabled.

Test Build Status

npm test

Unlicensed

This is free and unencumbered public domain software. For more information, see UNLICENSE.