GithubHelp home page GithubHelp logo

json_merger's People

Contributors

andlrc avatar hartca avatar peter-nobbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

json_merger's Issues

Use `json_merger` as loader for webpack

I think it would be very handy to use this tool as loader for webpack.
for example:

        preLoaders: [
            {
                test: /\.json$/,
                loader: 'json_merger',
            }
        ],

So, it will be possible to generate .json from the pieces during the build.

But, webpack sends to the loader function only content and not path to the file.
So, how about to add one more public method (compile/generate/interpolate), which will take json, working context and will return the generated result.
for example:

var result = json_merger.compile(json, {
   context: __dirname + '/some/path';
});

Get list of touched (by `@extends`) files

I've created webpack loader based on your tool: https://github.com/kopach/json_merger-loader
And now I would like to update it to have an ability to auto recompile files if something got changes. To do so I would need to get somehow all touched files. For example, if fileA.json uses ./path/fileB.json which uses ./fileC.json and so on, I would like to have the list of next files with related to the main file fileA.json paths. In this case it would be like so:

['./path/fileB.json', './path/fileC.json']

Is there any chance to update json_merger to have such functionality? The interface I can imagine may look like this:

var merger = json_merger(json, {
   scope: '/some/path';
});

var paths = merger.getListOfTouchedFiles();
var result = merger.merge();

Remove item from object / array

Is there a way to remove items from object or array?
Perhaps something along these lines:

animals.json

{
  "animals": ["dog", "cat", "lion"]
}

pets.json

{
  "@extends": "animals.json",
  "@subtract": ["animals"],
  "animals": ["tiger"]
}

json_merger pets.json

{
  "animals": ["dog", "cat"]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.