JSPM

compson

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q22051F
  • License MIT

Composite JSON turns json files into modules

Package Exports

  • compson

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

Readme

CompSON

Build Status npm version

CompSON turns json files into modules.

When creating a new json data file, you can include contents of other data files and modify the data objects to fit your needs. You can clone, modify, replace, or hide any data object in your files and you can use regular expressions to perform group operations.

Installation

npm install --save compson

Example

let compson = require('compson');

let schema = {
  furniture: {}
};

let hotelRoom = {
  "furniture": {
    "bed1": {
      "type": "bed",
      "size": "queen",
      "linens": "silk",
      "mattress": "foam"
    },
    "bed2": {
      "clone": "bed1",
      "mattress": "innerspring"
    }
  }
}
;

let output = compson(hotelRoom, schema, null, null);

console.log(JSON.stringify(output, null, 4));

The output should be

{
    "furniture": {
        "bed1": {
            "type": "bed",
            "size": "queen",
            "linens": "silk",
            "mattress": "foam"
        },
        "bed2": {
            "type": "bed",
            "size": "queen",
            "linens": "silk",
            "mattress": "innerspring"
        }
    }
}

Tests

npm test

License

MIT