3e12fd20 by Chad Hietala

Added polyfills for Array::map and String::trim

1 parent 4f048110
......@@ -6,6 +6,30 @@
# The Rivets namespace.
Rivets = {}
# Polyfill For String::trim
unless String::trim
String::trim = -> return @.replace(/^\s\*/, '').replace(/\s\s*$/, '')
# Polyfill For Array::map
unless Array::map
Array::map = (callback) ->
if this is null
throw new TypeError "Can't convert #{this} to object"
O = Object(this)
len = O.length >>> 0
throw new TypeError "#{callback} is not a function" unless typeof callback is 'function'
T = arguments[1]
A = new Array(len)
k = 0;
while k < len
A[k] = callbackfn.call(T, O[k], k, O) if k of O
k++
return A
# A single binding between a model attribute and a DOM element.
class Rivets.Binding
# All information about the binding is passed into the constructor; the DOM
......