@@ -122,6 +122,8 @@ function getFruitsCount() {
122122}
123123```
124124
125+ > See also [ compose] ( #compose ) .
126+
125127### ` set `
126128Declaratively sets a variable with value ` A ` to value ` B ` .
127129
@@ -157,7 +159,7 @@ console.log(fruits) // 5
157159Requests for a data, which takes time (i.e. async request).
158160``` js
159161function fetchPosts (postCount ) {
160- return fetch (' https://api.dev/posts' , { ... })
162+ return fetch (' https://api.dev/posts' , {... })
161163}
162164```
163165
@@ -167,19 +169,16 @@ Removes something *from* somewhere.
167169For example, if you have a collection of selected filters on a search page, removing one of them from the collection is ` removeFilter ` , ** not** ` deleteFilter ` (and this is how you would naturally say it in English as well):
168170
169171``` js
170- const selectedFilters = [' price' , ' availability' , ' size' ]
171-
172- function removeFilter (filterName ) {
173- const filterIndex = selectedFilters .indexOf (filterName)
174-
175- if (filterIndex !== - 1 ) {
176- selectedFilters .splice (filterIndex, 1 )
177- }
178-
179- return selectedFilters
172+ function removeFilter (filterName , filters ) {
173+ return filters .filter (name => name !== filterName)
180174}
175+
176+ const selectedFilters = [' price' , ' availability' , ' size' ]
177+ removeFilter (' price' , selectedFilters)
181178```
182179
180+ > See also [ delete] ( #delete ) .
181+
183182### ` delete `
184183Completely erazes something from the realms of existance.
185184
@@ -191,6 +190,8 @@ function deletePost(id) {
191190}
192191```
193192
193+ > See also [ remove] ( #remove ) .
194+
194195### ` compose `
195196Creates a new data from the existing one. Mostly applicable to strings or objects.
196197
@@ -200,6 +201,8 @@ function composePageUrl(pageName, pageId) {
200201}
201202```
202203
204+ > See also [ get] ( #get ) .
205+
203206### ` handle `
204207Handles a dedicated action. Often used in naming the callback methods.
205208
0 commit comments