Tidy ADR27 test

This commit is contained in:
willclarktech
2020-08-11 13:35:15 +02:00
parent d0ff5fabca
commit c25fe02413
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ describe("adr27", () => {
expect(omitDefault(0.0)).toEqual(null);
});
it("works for repeaded", () => {
it("works for repeated", () => {
expect(omitDefault(["a", "b", "c"])).toEqual(["a", "b", "c"]);
expect(omitDefault([])).toEqual(null);
});
@@ -69,7 +69,7 @@ describe("adr27", () => {
expect(omitDefaults(0.0)).toEqual(null);
});
it("works for repeaded", () => {
it("works for repeated", () => {
expect(omitDefaults(["a", "b", "c"])).toEqual(["a", "b", "c"]);
expect(omitDefaults([])).toEqual(null);
});
+3 -3
View File
@@ -41,10 +41,10 @@ export function omitDefaults(input: any): any {
// Object
if (isNonNullObject(input)) {
return Object.keys(input).reduce(
(accumulator, key) => ({
return Object.entries(input).reduce(
(accumulator, [key, value]) => ({
...accumulator,
[key]: omitDefaults((input as any)[key]),
[key]: omitDefaults(value),
}),
{},
);