Skip to content

Commit 6f3ce0c

Browse files
author
Scott Switzer
committed
Missing fromObject creates empty object wankdanker#48
1 parent e91f4c6 commit 6f3ce0c

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,4 +2147,31 @@ test('Ensure that multi-dimentional arrays work #41', function (t) {
21472147
t.end();
21482148
});
21492149

2150+
test('Make sure no objects are created without data #48', function (t) {
2151+
var obj = {
2152+
"a" : 1234,
2153+
"foo": {
2154+
"bar": null
2155+
}
2156+
};
2157+
2158+
var expect = {
2159+
foo:{
2160+
a:1234
2161+
}
2162+
};
2163+
2164+
var map = {
2165+
'foo.bar' : 'bar.bar',
2166+
'a': 'foo.a'
2167+
};
2168+
2169+
2170+
var result = om(obj, map);
2171+
2172+
t.deepEqual(result, expect);
2173+
t.end();
2174+
});
2175+
2176+
21502177

0 commit comments

Comments
 (0)