{"issue":{"state":"closed","created_at":"2011-10-24T15:11:05Z","updated_at":"2011-12-10T14:37:39Z","comments":6,"user":{"gravatar_id":"67fee7895a99cd5fd0b7de080548db12","id":26638,"url":"https://api.github.com/users/wavded","avatar_url":"https://secure.gravatar.com/avatar/67fee7895a99cd5fd0b7de080548db12?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"wavded"},"body":"### Idea\r\n\r\n```coffee\r\n  options = { price: 30, markdown: 3.2 }\r\n  { type = 'Create' , price, markdown } = options\r\n  console.log(type) #Create\r\n```\r\n\r\n### Motivation\r\n\r\nFor functions that take in multiple arguments, using an `options` argument has no simple way to make defaults for missing properties.  However this could be helpful when destructuring anything.  Thoughts?","assignee":null,"id":2034651,"number":1800,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[{"name":"duplicate","color":"cccccc","url":"https://api.github.com/repos/jashkenas/coffee-script/labels/duplicate"}],"title":"Defaults for Destructuring Assignment","html_url":"https://github.com/jashkenas/coffee-script/issues/1800","closed_at":"2011-10-24T15:23:47Z","url":"https://api.github.com/repos/jashkenas/coffee-script/issues/1800","milestone":null},"action":"created","comment":{"created_at":"2011-12-10T14:37:39Z","updated_at":"2011-12-10T14:37:39Z","user":{"gravatar_id":"b60683e6dacd4556ae15430a7c9b6f13","id":142908,"url":"https://api.github.com/users/showell","avatar_url":"https://secure.gravatar.com/avatar/b60683e6dacd4556ae15430a7c9b6f13?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"showell"},"body":"@bigeasy It's such a small function, I would consider just subsuming it into your own personal helpers library.  This way you break the dependency with very little duplication:\r\n\r\n```\r\n# Extend a source object with the properties of another object (shallow copy).\r\nextend = exports.extend = (object, properties) ->\r\n  for key, val of properties\r\n    object[key] = val\r\n  object\r\n```\r\nThere's no guarantee coffee-script will keep helpers.coffee structured as it is now.  That's why I recommend that you either copy the function into your own codebase or use underscore.js (which makes more of a promise of a stable API).\r\n\r\n\r\n\r\n","id":3091088,"url":"https://api.github.com/repos/jashkenas/coffee-script/issues/comments/3091088"}}