Skip to content

Latest commit

 

History

History
27 lines (24 loc) · 557 Bytes

README.md

File metadata and controls

27 lines (24 loc) · 557 Bytes

node-substrate

A simple Node Module used for whitelist filtering of object and json inputs.

Inspired by https://github.com/visionmedia/node-only

Usage Example:

var substrate = require("substrate");
substrate(
	{//Original object to be filtered
		"a": 5,
		"b": 6,
		"c":{
			"pi": 3.14,
			"cake": "pi^2"
		},
		"d": 7
	},
	{//Filter / Whitelist declaration
		"a":true,
		"b":true,
		"c":{"cake":true}//Object instead of true allows objects to pass through. Rules are recursive.
	}
)//=>{"a":5,"b":6,"c":{"cake":"pi^2"}}