We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to rename keys in an object
> var _ = require('underscore'); > var note = { ... '_id': 1, ... 'title': 'Ruby is awesome..', ... 'text': '..and so is CoffeeScript' ... } > console.log(_.rename(note, [['_id', 'id']])); { id: 1, title: 'Ruby is awesome..', text: '..and so is CoffeeScript' }
or an array of objects
> var notes = [note, note]; > console.log(_.rename(notes, [['_id', 'id']])); [ { id: 1, title: 'Ruby is awesome..', text: '..and so is CoffeeScript' }, { id: 1, title: 'Ruby is awesome..', text: '..and so is CoffeeScript' } ]
Thanks, Nisanth
The text was updated successfully, but these errors were encountered:
Thanks, but no thanks -- way too special case for core Underscore. Feel free to mix it in for your own purposes.
Sorry, something went wrong.
No branches or pull requests
Add function to rename keys in an object
or an array of objects
Thanks,
Nisanth
The text was updated successfully, but these errors were encountered: