Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit ee22aa4

Browse files
3nochpetebacondarwin
authored andcommitted
docs(guide/filter): imrpove explanation of "pure function"
Improve the explanation of what a "pure function" is in simple words. The previous explanation could be confusing, especially since the term "idempotent" (here used in it's broader "Computer Science" meaning) is overloaded and has much stricter semantics in Mathematics or pure Functional Programming. Closes #15173
1 parent 8b11ca6 commit ee22aa4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/content/guide/filter.ngdoc

+3-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ as the first argument. Any filter arguments are passed in as additional argument
109109
function.
110110

111111
The filter function should be a [pure function](http://en.wikipedia.org/wiki/Pure_function), which
112-
means that it should be stateless and idempotent, and not rely for example on other Angular services.
113-
Angular relies on this contract and will by default execute a filter only when the inputs to the function change.
112+
means that it should always return the same result given the same input arguments and should not affect
113+
external state, for example, other Angular services. Angular relies on this contract and will by default
114+
execute a filter only when the inputs to the function change.
114115
{@link guide/filter#stateful-filters Stateful filters} are possible, but less performant.
115116

116117
<div class="alert alert-warning">

0 commit comments

Comments
 (0)