Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    akudahewa
    @akudahewa
    hi
    small issue in object-mapper in npm.
    mfrr1118
    @mfrr1118
    Hi! Is anyone online?
    mfrr1118
    @mfrr1118
    I figured out the question i had. This rocks! Thanks!!!!
    Dan VerWeire
    @wankdanker_twitter
    @mfrr1118 cool! Glad you got it figured out! :)
    reffjitter
    @reffjitter
    Hey. I am dancing around an issue. I am trying to copy an array from the source to destination. I saw a test that does basically what I need. The test name is 'mapping - map full array to same array on destination side'. The problem is that this functionality to work with base level attributes but if they are nested, then it only copies over the first item in the array.
    for example
    map = {
    'person_id':'personId'
    ,'medical_claims[].revenue_code_descriptions':'medicalClaims[].revenueCodeDescriptions'}
    reffjitter
    @reffjitter

    with this object
    payload = {
    "person_id": "dd1798",
    "medical_claims": [{
    "revenue_code_descriptions": ['something', 'else']
    }],
    "json_create_date": "2016-09-19"
    };

    Gives
    medicalClaims:[revenue_code_descriptions:"something"]
    instead of
    medicalClaims:[revenue_code_descriptions:["something","else"]]

    But if that array was on the top level, then you would get what you would expect
    payload = {
    "revenue_code_descriptions": ['something', 'else'],
    "json_create_date": "2016-09-19"
    };

    map = {
    'revenue_code_descriptions':'revenueCodeDescriptions'}
    result
    {
    revenue_code_descriptions:["something","else"],
    "

    Hope that make sense. I have tried to add the '+' at the end, but can not find a combination that works.
            var payload = {
                "medical_claims": [{
                    "revenue_code_descriptions": ['something', 'else']
                }, {
                    "revenue_code_descriptions": []
                }]
            };
    
            should have a destination with 
            {
                "medical_claims": [{
                    "revenue_code_descriptions": ['something', 'else']
                }, {
                    "revenue_code_descriptions": []
                }]
            };
    sergioesp
    @sergioesp
    Hi, currently using object-mapper to map requests coming from the client, and today just hit a scenario where I would need the source keys to be case insensitive. What would be the best way to approach this? As a quick fix, I created a new object with lower case keys before passing it to object-mapper and modified json mapping file to expect lowercase keys.
    Ahmad Iqbal Ali
    @ahmadiq

    Hi @wankdanker_twitter , I'm currently exploring this tool and it seems quite cool.
    One thing I wanted to confirm, which i couldn't completely understand from the documentation. Is there a way to create a new key in the destination object with a value that is calculated based on multiple keys in the source object?

    for example if i have the source object:
    {a:"true",b:"false",c:"true"}

    can i get a destination object {d:"true"}

    based on a transformation logic such as if(a=="true" && b=="false" && c=="true"){return "true"}

    something to that effect.

    Ahmad Iqbal Ali
    @ahmadiq

    I ended up accessing the source properties from the fromObject being passed into the transform function as in the below map:

    var map = {
    'd': {
    key: 'a',
    transform: function (value, fromObject, toObject, fromKey, toKey) {
    if(fromObject.a==="true" && fromObject.b==="false" && fromObject.c==="true") {
    return "false";
    }
    return "true";
    }
    }
    };

    Let me know if this looks ok, or if there is a better way to implement this. Thanks.
    Huy Tran
    @httran13
    Hello, i am trying to map a property alias, for some weird reason its not mapping, is that any reservation on alias?
    the property name is alias
    Huy Tran
    @httran13
    Hello?
    Philip Morris
    @Morriphi
    Hi, I'm wondering if it's possible to pass an option to disable the parsing of keys so I can use "foo.bar" as an absolute rather than it destructing to {foo: {bar: ''}}. Happy to submit a PR if this is something that would be considered.