Ad
  • Custom User Avatar

    The kata's premise is flawed: JS objects do not exactly follow key insertion order, but is defined as

    1. Positive integer-like keys in ascending order
    2. String keys in insertion order
    3. Symbols in insertion order

    Only Maps and Sets retain insertion order regardless of key/value types.

  • Custom User Avatar

    Needs edge case with 0 input arguments: at least 1 solution fails in this case.

  • Custom User Avatar
  • Custom User Avatar

    This is an issue.

    (By the way, your proposed compareObjects is bug-ridden.)

  • Custom User Avatar

    Your code didn't close properly.

  • Custom User Avatar

    Unpublishing as a duplicate.

  • Custom User Avatar

    which returns true if the passed string is a palindrome, regardless of capitalisation

  • Custom User Avatar

    Random tests feature uppercase and lowercase characters but the kata description doesn't warn about this.

  • Custom User Avatar

    Expected: {"name":"Joe Doe","address":"123 Fake Street","year":2010,"married":true,"allergies":"nuts"},
    instead got: {"year":2010,"name":"Joe Doe","address":"123 Fake Street","married":true,"allergies":"nuts"}
    You're comparing objects with JSON.stringify, which means order will affect it. You should compare it by iterating through the object keys and seeing if they're both the same values instead, like this

    function compareObjects(a,b) {
      let keys = Object.keys[a];
      for (let i = 0; i < keys.length; i++) {
        if (a[keys[i]] !== b[keys[i]]) return false;
      }
      return true;
    }
    

    EDIT: oh, just reread the description. "The fields should be in order of their first chronological appearance in a log."
    This still seems silly to me though, as JS objects aren't meant to be ordered anyway AFAIK. If you want it to be ordered, maybe you could make a 2d array instead, like this:

    [["name", "Joe Doe"], ["address", "123 Fake Street"], ["year", 2010], ["married", true], ["allergies", "nuts"]];
    

    Changed label to suggestion.

  • Custom User Avatar

    Fixture broken?

    [eval]:31 Test.assertEquals(JSON.stringify(mixin(...log)),'{"name":"Joe Doe","address":"123 Fake Street","year":2010,"married":true,"allergies":"nuts"}',);; ^ SyntaxError: Unexpected token ) at Object.exports.runInThisContext (vm.js:53:16) at Object. ([eval]-wrapper:6:22)
        at 
        at node.js:328:29
        at _combinedTickCallback (internal/process/next_tick.js:67:7)
        at process._tickCallback (internal/process/next_tick.js:98:9)
    
  • Custom User Avatar

    Ah, my mistake! When I searched I forgot to include beta kata, so it only showed 11 Palindrome related kata, and all of them were significantly different and more difficult than just testing whether something is a palindrome.

  • Default User Avatar

    Duplicate of a lot of katas.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution