Git Product home page Git Product logo

Comments (7)

blikblum avatar blikblum commented on September 21, 2024

Using the shorthand notation to return the object works. See this example.

from buble.

adrianheine avatar adrianheine commented on September 21, 2024

This has been fixed with #34, i. e. >=0.17.1.

from buble.

blikblum avatar blikblum commented on September 21, 2024

Using 0.17.3 here with same problem with the complete example

Below actual input / output using 0.17.3:

export const deepifyKeys = (obj) => mapObject(obj,
  ([key, val]) => {
    const dashIndex = key.indexOf('-')
    if (dashIndex > -1) {
      return {
        [key.slice(0, dashIndex)]: {
          [key.slice(dashIndex + 1)]: val
        }
      }
    }
    return { [key]: val }
  }
)
export var deepifyKeys = function (obj) { return mapObject(obj,
  function (ref) {
    var key = ref[0];
    var val = ref[1];

    var dashIndex = key.indexOf('-')
    if (dashIndex > -1) {
      return ( obj$1 = {}
      var obj;, obj$1[key.slice(0, dashIndex)] = ( obj = {}, obj[key.slice(dashIndex + 1)] = val, obj ), obj$1 )
      var obj$1;
    }
    return ( obj$2 = {}, obj$2[key] = val, obj$2 )
    var obj$2;
  }
); }

from buble.

adrianheine avatar adrianheine commented on September 21, 2024

Hm, can you double-check that you are indeed using the right bublé version? On my system, this looks fine:

$ bin/buble --version
Bublé version 0.17.3

$ echo "const deepifyKeys = (key, val) => {
  return { [key]: val }
}" | bin/buble
var deepifyKeys = function (key, val) {    
  return ( obj = {}, obj[key] = val, obj )
  var obj;
}

from buble.

blikblum avatar blikblum commented on September 21, 2024

Hm, can you double-check that you are indeed using the right bublé version? On my system, this looks fine:

See above. The simplified version works with 0.17.3, but the complete do not work. I double checked the version in my environment

from buble.

adrianheine avatar adrianheine commented on September 21, 2024

I see. I think the problem is the nesting of computed properties:

return {
  [key.slice(0, dashIndex)]: {
    [key.slice(dashIndex + 1)]: val
  }
}

I'll look into that.

from buble.

blikblum avatar blikblum commented on September 21, 2024

@adrianheine
Many thanks

from buble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.