0.0.7 • Published 11 years ago

split-keys v0.0.7

Weekly downloads
79
License
unlicense
Repository
github
Last release
11 years ago

Split Keys Build Status

Gracefully declare properties aliases within objects. Split-keys splits comma-separated keys in object and for each key creates property alias.

Before:

var a = {
	x: {
		a: 1,
		b: 1
	}
};

//create alias
a.y = a.x;

After:

//declare list of aliases
var a = splitKeys({
	'x, y': {
		a: 1,
		b: 1
	}
});

Use

$ npm install split-keys

var splitKeys = require('split-keys');

var obj = splitKeys({
	'a, b': function(){}
});

obj.a === obj.b //true

API

  • splitKeys(object) — split comma-separated properties

  • splitKeys(object, deep) — split comma-separated properties, including inner objects

  • splitKeys(object, separator) — apply custom separator to split. Separator can be whether a string or a RegExp.

  • splitKeys(object, separator, deep) or splitKeys(object, deep, separator) — apply custom separator to deep split keys

NPM

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago