Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.
/ compson Public archive

Composite JSON turns json files into modules.

License

Notifications You must be signed in to change notification settings

chaserjs/compson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Composite JSON turns json files into modules.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published