lodashのv4から_.where
がなくなっていました。
lodash v4.15のドキュメント
lodash v3.10.0のドキュメント
非推奨のメソッド
_.where
が消えた理由を探していたら、下記のサイトを見つけました。
https://github.com/jashkenas/underscore/issues/1155
This seems more consistent since the potential in the future is to provide other fns that get the first of something or get all of something. This approach always relegates getting the first of something to _.find and getting all of something to _.filter.
javascript
1_.where(comedians, {type: 'stooge'}) // becomes... 2_.filter(comedians, _.match({type: 'stooge'}))
質問
- 上記参考サイトに書かれていることをまとめると、「
_.where
を使わなくても、_.filter
と_.match
で同じことを実現できるから非推奨にした」と、合っているでしょうか?
英語が苦手なので少し不安に思いました。
- 参考にしたサイトは公式情報とみなしてよいのでしょうか?
投稿日時が2013年7月と少し古いので気になりました。
_.where
が消えた理由の公式情報が書かれたサイトがあれば、教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。