0.0.1 • Published 9 years ago

format-obj v0.0.1

Weekly downloads
38
License
-
Repository
github
Last release
9 years ago

format-obj

This module is part of the Lackey CMS.

The modules helps in converting the object key names and selecting a subset of properties. If data is an array the mapping will affect every item

Install

npm install format-obj

Usage

var formatter = require('format-obj'),
	obj;

obj = formatter({
	_id: 123,
	title: 'OK',
	test: 456
}, '_id:id title');

// returns 
// {
//    id: 123,
//    title: 'OK'
// }

Using the * character

var formatter = require('format-obj'),
	obj;

obj = formatter({
	_id: 123,
	title: 'OK',
	test: 456
}, '_id:id *');

// returns 
// {
//    id: 123,
//    title: 'OK',
//    test: 456
// }