Giter VIP home page Giter VIP logo

extend's People

Contributors

chilingling avatar yanhaijing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

wpanglelina

extend's Issues

不能处理循环引用

问题是什么

不能处理循环引用

环境

  • 浏览器:chrome 73.0.3683.75

在线例子

// case 1, 自身有环
const obj = {
  foo: {
    bar:null
  }
}
obj.foo.bar = obj.foo 
// case 2, 互相引用
const obj1 = {
  foo: {
    bar:null
  }
}
const obj2 = {
  baa: {
    caa:obj1.foo
  }
}
obj1.foo.bar = obj2.baa
extend(true, obj1,obj2);

其他

我试了下 jquery 也不能处理这种, 看了下他源码, 处理的方式和你是一样的, 能解释下为什么要这么处理吗,如果真有循环引用的话, 会一直不能 return target ,那么这个判断条件就一直是 false 呀.

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.