object
align({
a: 'b',
c: 'dddddd',
e: 'fff',
g: 'hhhhh'
});
Results in:
{
a: ' b',
c: 'dddddd',
e: ' fff',
g: ' hhhhh',
}
Specific property in object of objects
align('foo', {
a: {
foo: 'a',
bar: 'z'
},
b: {
foo: 'aaaaaaa',
bar: 'z'
},
c: {
foo: 'aaa',
bar: 'z'
}
});
Results in:
{ a: { foo: ' a', bar: 'z' },
b: { foo: 'aaaaaaa', bar: 'z' },
c: { foo: ' aaa', bar: 'z' } }
array of objects
var align = require('{%= name %}');
var arr = [{a: 'b'}, {a: 'bb'}, {a: 'bbbb'}, {a: 'bbb'}, {a: 'bb'}];
align(arr, 'a');
Results in:
[
{a: ' b'},
{a: ' bb'},
{a: 'bbbb'},
{a: ' bbb'},
{a: ' bb'}
];