aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils.coffee')
-rw-r--r--lib/utils.coffee7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee
index b7f8731a..428112c8 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -147,6 +147,13 @@ Array.copy = (array) -> Array.prototype.slice.call(array, 0)
String::startsWith = (str) -> @indexOf(str) == 0
+Array::rotate = (count) ->
+ return this if @length == 0
+ count = count % @length
+ count = count + @length if count < 0
+ Array::push.apply(this, @splice(0, count))
+ this
+
globalRoot = window ? global
globalRoot.extend = (hash1, hash2) ->
for key of hash2