Giter Site home page Giter Site logo

Simplify about deep-assign HOT 1 CLOSED

sindresorhus avatar sindresorhus commented on July 19, 2024
Simplify

from deep-assign.

Comments (1)

schnittstabil avatar schnittstabil commented on July 19, 2024

Thank you for suggestion, but I don't think you spend enough time to get deeply into the project aims. Please take some time and a take look at our test.js to figure out how we expect deep-assign to be.

Despite this, your suggestion lacks some essential properties. First of all, this is a node package, thus we cannot use all ES2015 features, like export etc. Secondly, your suggestion is not even consistent with Object.assign, e.g.:

  1. Parameter and return values

    Object.assign({}, {foo:'bar'}, {unicorns: 'many'})
    //=> { foo: 'bar', unicorns: 'many' }
    
    mergeDeep({}, {foo:'bar'}, {unicorns: 'many'})
    //=> undefined
  2. Symbol support

    var target = {};
    Object.assign(target, {[Symbol.for('foo')]: 'bar'});
    target[Symbol.for('foo')]
    //=> 'bar'
    
    var target = {};
    mergeDeep(target, {[Symbol.for('foo')]: 'bar'});
    target[Symbol.for('foo')]
    //=> undefined
  3. Functions and Arrays are Objects too

    var target = () => 42;
    Object.assign(target, { foo: 'bar' });
    target.foo
    //=> 'bar'
    
    var target = () => 42;
    mergeDeep(target, { foo: 'bar' });
    target.foo
    //=> undefined

from deep-assign.

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.