【发布时间】:2017-05-04 22:50:00
【问题描述】:
以下面的对象为例:
var object = {
some_key: 'some value',
some_other_key: 'some other value',
AKey: 'notice that some will have underscores and some wont.'
callBackl: 'http://google.ca'
}
应该变成:
var object = {
AKey: 'notice that some will have underscores and some wont.'
callBackl: 'http://google.ca'
some_key: 'some value',
some_other_key: 'some other value',
}
我还没有找到一个 lodash 解决方案,而且我在堆栈上找到了很多解决方案,such as this one,看起来......很复杂。也许这不是微不足道的?
想法?
【问题讨论】:
-
@OliviaRuth 这个解决方案的问题是它很乱。它不干净。太恶心了。
-
就是这样。 stackoverflow.com/a/31102605/7947361 似乎是最新的。这么老,有这么多票,看起来和你一样好。
标签: javascript