sassfp
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "sassfp", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Library of functional methods for Sass", | ||
@@ -5,0 +5,0 @@ "main": "SassFP.scss", |
@@ -28,2 +28,3 @@ # SassFP | ||
- [map](#map) | ||
- [map-with-index](#map-with-index) | ||
- [filter](#filter) | ||
@@ -270,3 +271,3 @@ - [reject](#reject) | ||
As of **`v1.2`**, **`$fn`** may itself be a list where the first member is the function to be run against each member of **`$list`**, and the others are extra arguments that the function would require in effect allowing functions to be decorated. | ||
As of **`v1.2.0`**, **`$fn`** may itself be a list where the first member is the function to be run against each member of **`$list`**, and the others are extra arguments that the function would require, in effect allowing functions to be decorated. | ||
@@ -280,3 +281,3 @@ ```scss | ||
Because Sass supports space-separated lists, the commas are optional, and omitting them may increase legibility and in any case is equivalent. | ||
Because Sass supports space-separated lists, the commas are optional, and omitting them may increase legibility. | ||
@@ -287,4 +288,13 @@ ```scss | ||
Most important, however, is that the value(s) provided by iterating over **`list` must always be in the last argument position `$fn` expects**. | ||
Most important, however, is that the value(s) provided by iterating over **`$list` must always be in the last argument position `$fn` expects**. | ||
### map-with-index | ||
`($fn, $list)` | ||
Returns a new list where each member of **`$list`** has had function **`$fn`** run against it and its index as two arguments. Works identically to [map](#map), but with the item's index passed as an additional argument to **`$fn`** in the last argument position and the value provided by **`$list`** in the second-to-last. | ||
```scss | ||
map-with-index(prefixStr, ("alex", "billy", "charlie")); // => ("alex1", "billy2", "charlie3") | ||
map-with-index(add, (4, 5, 6)); // => (5, 7, 9) | ||
``` | ||
### filter | ||
@@ -291,0 +301,0 @@ `($predicate, $list)` |
Sorry, the diff of this file is not supported yet
32267
837