mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Optimized repeat and its tests
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# -------
|
||||
|
||||
# pull the helpers from `CoffeeScript.helpers` into local variables
|
||||
{starts, ends, compact, count, merge, extend, flatten, del, last} = CoffeeScript.helpers
|
||||
{starts, ends, repeat, compact, count, merge, extend, flatten, del, last} = CoffeeScript.helpers
|
||||
|
||||
|
||||
# `starts`
|
||||
@@ -27,6 +27,15 @@ test "the `ends` helper can take an optional offset", ->
|
||||
ok not ends('01234', '234', 6)
|
||||
|
||||
|
||||
# `repeat`
|
||||
|
||||
test "the `repeat` helper concatenates a given number of times", ->
|
||||
eq 'asdasdasd', repeat('asd', 3)
|
||||
|
||||
test "`repeat`ing a string 0 times always returns the empty string", ->
|
||||
eq '', repeat('whatever', 0)
|
||||
|
||||
|
||||
# `compact`
|
||||
|
||||
test "the `compact` helper removes falsey values from an array, preserves truthy ones", ->
|
||||
|
||||
Reference in New Issue
Block a user