Ad
  • Custom User Avatar

    For JS: Moving all usages of Proxy from class constructor to getters helped me.

  • Custom User Avatar
      const inspect = Symbol.for('nodejs.util.inspect.custom');
      // ...
      toString() {
        return "321";
      }
      get [Symbol.toStringTag]() {
        return 'Validator';
      }
      [inspect]() {
        return "123";
      }
    

    doesn't solve the problem

  • Custom User Avatar

    If the grammar was different, such cases would be handled! But you're right, I could have added \b.

  • Default User Avatar

    Very nice, lazy evaluation. One thing to improve though:
    keywords get mixed with identifiers - for input buffer 'ifonly' the lexer will output 2 tokens Keyword(if) Identifier(only), where it should only one Keyword(ifonly)

  • Custom User Avatar

    Symbol.toStringTag is passed into an object when Object.prototype.toString of that object is called:

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag

    So you'll need to handle this case as well.

    Edit: In addition, Node itself uses util.inspect.custom symbol when inspecting objects:

    https://nodejs.org/api/util.html#util_util_inspect_custom

  • Custom User Avatar

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

  • Default User Avatar

    My implementation doesn't use Symbol either (at least not explicitly).

  • Custom User Avatar

    I didn't do the JS translation but I can tell you that Symbol is not used anywhere in the reference solution.

  • Custom User Avatar

    It would be good to know whether or not this is a chai incompatibility error, or whether it is a requirement for the task that Thing not have anything using Symbols...:hmm?

  • Custom User Avatar

    Yup, I too am at this point.

  • Custom User Avatar

    I'm facing with error something like your. In Browser everything working good. Sad that I spent many time for all tests are passed, and can't finish this kata :(

    jane = new Thing("Jane") creates a new object

    • TypeError: value.lookupGetter is not a function
    • at formatProperty
    • at /runner/node_modules/chai/lib/chai/utils/inspect.js:174:14
    • at Array.map
    • at formatValue
    • at formatProperty
    • at /runner/node_modules/chai/lib/chai/utils/inspect.js:174:14
    • at Array.map
    • at formatValue
    • at inspect
    • at module.exports
    • at /runner/node_modules/chai/lib/chai/utils/getMessage.js:46:49
    • at RegExp.[Symbol.replace]
    • at RegExp.[Symbol.replace]
    • at String.replace
    • at Object.module.exports [as getMessage]
    • at Assertion.chai.Assertion.assert
  • Default User Avatar

    I'm experiencing the same issue.

    jane = new Thing("Jane") creates a new object

    TypeError: Cannot convert a Symbol value to a string
    at Object.get
    at objectToString
    at isRegExp
    at formatValue
    at formatProperty
    at /runner/node_modules/chai/lib/chai/utils/inspect.js:174:14
    at Array.map
    at formatValue
    at inspect
    at module.exports
    at /runner/node_modules/chai/lib/chai/utils/getMessage.js:46:49
    at RegExp.[Symbol.replace]
    at RegExp.[Symbol.replace]
    at String.replace
    at Object.module.exports [as getMessage]
    at Assertion.chai.Assertion.assert

    I'm going to keep working on the rest of the kata, but unless this is resolved I won't be able to submit it - so I hope I'm not setting myself up for disappointment!

  • Custom User Avatar

    I'm facing the same issue. This assertion has some trouble on codewars, but it passes on my machine with node v6.10.3 and chai v3.5.0.
    I have also translated the tests to run them with should (v11.1.2) instead of chai, and again, everything is ok.
    Maybe a problem with an old chai version?

  • Default User Avatar

    I'm having some trouble with the first assertion. Every other passes.
    In the browser I'm getting:

    const jane = new Thing('Jane');
    typeof jane //object
    

    But chai fails with
    TypeError: Cannot convert a Symbol value to a string

    Can it be something with my code, or an error in chai?

  • Default User Avatar

    This is a compiler, not an interpreter :D

    Love it!

  • Loading more items...