55{starts , ends , compact , count , merge , extend , flatten , del , last } = CoffeeScript .helpers
66
77
8- # ### `starts`
8+ # `starts`
99
1010test " the `starts` helper tests if a string starts with another string" , ->
1111 ok starts (' 01234' , ' 012' )
@@ -16,7 +16,7 @@ test "the `starts` helper can take an optional offset", ->
1616 ok not starts (' 01234' , ' 01' , 1 )
1717
1818
19- # ### `ends`
19+ # `ends`
2020
2121test " the `ends` helper tests if a string ends with another string" , ->
2222 ok ends (' 01234' , ' 234' )
@@ -27,15 +27,15 @@ test "the `ends` helper can take an optional offset", ->
2727 ok not ends (' 01234' , ' 234' , 6 )
2828
2929
30- # ### `compact`
30+ # `compact`
3131
3232test " the `compact` helper removes falsey values from an array, preserves truthy ones" , ->
3333 allValues = [1 , 0 , false , obj = {}, [], ' ' , ' ' , - 1 , null , undefined , true ]
3434 truthyValues = [1 , obj, [], ' ' , - 1 , true ]
3535 arrayEq truthyValues, compact (allValues)
3636
3737
38- # ### `count`
38+ # `count`
3939
4040test " the `count` helper counts the number of occurances of a string in another string" , ->
4141 eq 1 / 0 , count (' abc' , ' ' )
@@ -46,7 +46,7 @@ test "the `count` helper counts the number of occurances of a string in another
4646 eq 2 , count (' abcdabcd' ,' abc' )
4747
4848
49- # ### `merge`
49+ # `merge`
5050
5151test " the `merge` helper makes a new object with all properties of the objects given as its arguments" , ->
5252 ary = [0 , 1 , 2 , 3 , 4 ]
@@ -58,7 +58,7 @@ test "the `merge` helper makes a new object with all properties of the objects g
5858 eq val, merged[key]
5959
6060
61- # ### `extend`
61+ # `extend`
6262
6363test " the `extend` helper performs a shallow copy" , ->
6464 ary = [0 , 1 , 2 , 3 ]
@@ -69,23 +69,23 @@ test "the `extend` helper performs a shallow copy", ->
6969 eq 2 , obj[2 ]
7070
7171
72- # ### `flatten`
72+ # `flatten`
7373
7474test " the `flatten` helper flattens an array" , ->
7575 success = yes
7676 (success and= typeof n is ' number' ) for n in flatten [0 , [[[1 ]], 2 ], 3 , [4 ]]
7777 ok success
7878
7979
80- # ### `del`
80+ # `del`
8181
8282test " the `del` helper deletes a property from an object and returns the deleted value" , ->
8383 obj = [0 , 1 , 2 ]
8484 eq 1 , del (obj, 1 )
8585 ok 1 not of obj
8686
8787
88- # ### `last`
88+ # `last`
8989
9090test " the `last` helper returns the last item of an array-like object" , ->
9191 ary = [0 , 1 , 2 , 3 , 4 ]
0 commit comments