From b26cf73c12a98df5a0bb310e6a1f5245d7b5b407 Mon Sep 17 00:00:00 2001 From: Robbie Lane Date: Sun, 24 Jan 2016 07:35:47 -0700 Subject: [PATCH] change .where to .filter -.where has been removed in lodash 4.0 --- exercises/1_getting_started/exercise.js | 2 +- exercises/1_getting_started/problem.fr.md | 8 ++++---- exercises/1_getting_started/problem.ko.md | 8 ++++---- exercises/1_getting_started/problem.md | 8 ++++---- exercises/1_getting_started/solution/solution.js | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/exercises/1_getting_started/exercise.js b/exercises/1_getting_started/exercise.js index 023701a..a5f65a0 100644 --- a/exercises/1_getting_started/exercise.js +++ b/exercises/1_getting_started/exercise.js @@ -42,4 +42,4 @@ var testing = { } }; -module.exports = verify(testing, run); \ No newline at end of file +module.exports = verify(testing, run); diff --git a/exercises/1_getting_started/problem.fr.md b/exercises/1_getting_started/problem.fr.md index ce21edd..d24bba5 100644 --- a/exercises/1_getting_started/problem.fr.md +++ b/exercises/1_getting_started/problem.fr.md @@ -16,13 +16,13 @@ aucun problème pour vous habituer à **Lo-Dash** ! ## Allez, on s’y met Commençons avec une fonction très fréquemment utilisée de **Lo-Dash**, -appelée `where` : +appelée `filter` : ```js -_.where(collection, props) +_.filter(collection, props) ``` -`where` filtre `collection` en utilisant la condition définie par `props`. +`filter` filtre `collection` en utilisant la condition définie par `props`. `collection` peut être n’importe quoi -- un `Array`, du JSON ou un objet Javascript. ## Exemple @@ -33,7 +33,7 @@ var characters = [ { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } ]; -_.where(characters, { 'age': 36 }); +_.filter(characters, { 'age': 36 }); // [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] ``` diff --git a/exercises/1_getting_started/problem.ko.md b/exercises/1_getting_started/problem.ko.md index 064eb53..4d89200 100644 --- a/exercises/1_getting_started/problem.ko.md +++ b/exercises/1_getting_started/problem.ko.md @@ -9,13 +9,13 @@ 없으실 거예요. * * * ## 해봅시다 ## -**Lo-Dash**에서 아주 자주 사용하는 `where` 함수로 시작해보죠. +**Lo-Dash**에서 아주 자주 사용하는 `filter` 함수로 시작해보죠. ```js -_.where(collection, props) +_.filter(collection, props) ``` -`where`는 `props`에 정의된 조건을 사용해 `collection`을 필터링 합니다. +`filter`는 `props`에 정의된 조건을 사용해 `collection`을 필터링 합니다. `collection`은 배열, JSON 데이터, JavaScript 객체 등이 될 수 있습니다. #### 예제 #### @@ -25,7 +25,7 @@ var characters = [ { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } ]; -_.where(characters, { 'age': 36 }); +_.filter(characters, { 'age': 36 }); // [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] ``` diff --git a/exercises/1_getting_started/problem.md b/exercises/1_getting_started/problem.md index 2af84c6..4819024 100644 --- a/exercises/1_getting_started/problem.md +++ b/exercises/1_getting_started/problem.md @@ -8,13 +8,13 @@ heard of **[underscore.js](http://underscorejs.org/)**? **Lo-Dash** is a fork of that's awesome. You definitely won't have any trouble with **Lo-Dash**! * * * ## Down To Business ## -Let's start with a very often-used function in **Lo-Dash** called `where`: +Let's start with a very often-used function in **Lo-Dash** called `filter`: ```js -_.where(collection, props) +_.filter(collection, props) ``` -`where` filters `collection` using the condition defined by `props`. +`filter` filters `collection` using the condition defined by `props`. `collection` could be anything -- an Array, JSON data or a Javascript Object. #### Example #### @@ -24,7 +24,7 @@ var characters = [ { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } ]; -_.where(characters, { 'age': 36 }); +_.filter(characters, { 'age': 36 }); // [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] ``` diff --git a/exercises/1_getting_started/solution/solution.js b/exercises/1_getting_started/solution/solution.js index 25478b7..866204e 100644 --- a/exercises/1_getting_started/solution/solution.js +++ b/exercises/1_getting_started/solution/solution.js @@ -3,7 +3,7 @@ var _ = require("lodash"); var filterwhere = function (item) { - return _.where(item, {active: true}); + return _.filter(item, {active: true}); }; module.exports = filterwhere;