Ad
  • Custom User Avatar
  • Custom User Avatar

    Needs random tests

  • Custom User Avatar

    Initial code is wrong (zero arguments???)

  • Custom User Avatar

    Could do with random tests.

  • Custom User Avatar

    Tests like

    const object = flattenObject({ foo: { bar: 'test', baz: 'test' } });
    Test.assertEquals(object['foo.bar'], 'test');
    Test.assertEquals(object['foo.baz'], 'test');
    

    can be simplified to

    Test.assertDeepEquals(flattenObject({ foo: { bar: 'test', baz: 'test' } }), { 'foo.bar': 'test', 'foo.baz': 'test' });
    

    This also gives more meaningful messages, like

    ✘ Expected: { 'hai.yo.0': 1, 'hai.yo.1': 2, 'hai.yo.2': 3, 'hai.yo.3': 4 }, instead got: { 'hai.yo': [ 1, 2, 3, 4 ] }
    ✔ Test Passed: Value deep equals { 'hai.yo.0': 1, 'hai.yo.1': 2, 'hai.yo.2': 3, 'hai.yo.3': 4 }