1.0.3 • Published 8 years ago

pointify v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

NPM version Build Status Dependency Status

A browserify transform that resolves json pointers. A browserify transform that allows you to bundle json files inside other json files. Very loosely based on RFC 6901

Install

$ npm install --save pointify

Usage

var pointify = require('pointify');
var browserify = require('browserify');
var someJSONFile = require('./someJSONFile');

	var b = browserify();
	b.add(someJSONFile);
	b.transform(pointify);
        b.bundle(function(err, src){
           console.dir(src);
          //Prints {"owner":"{"name":"Gus"}};
        });

//In some json file
{"owner": {"$ref":"owner.json"}

//or alternatively embed the $ref in a string (not part of the rfc)
{"owner":"$ref owner.json"}

//owner.json
{"name":"Gus"}

##Notes

Check out RFC6901 before you use this transform. There is a nice example of its benefits here in relation to json schema.

This transform only deals with references expected to be in other files at the moment. Full support for in document schema is planned.

After using this on a project I no longer really see a need to support json pointer's syntax, doing so in a browserify transform seems like a lot of worth with little benifit. Maybe someday as an experiment, for now this transform is useful if you use what to have browserify combine some json files on your behalf.

All it does is require the json file and place it into the document. The requires are relative to the document calling require. No longer uses requires, it will load the contents of the file and parse them into JSON.

License

MIT © Lasana Murray

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.10

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago