1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

slightly nicer implementation of SplatNode.compileSplattedArray

This commit is contained in:
Jeremy Ashkenas 2010-07-13 22:16:19 -04:00
parent 8c34aff1c5
commit 0b87387fab
5 changed files with 43 additions and 28 deletions

View file

@ -1,5 +1,5 @@
(function(){
var compact, count, del, extend, flatten, helpers, include, indexOf, merge, starts;
var compact, count, del, ends, extend, flatten, helpers, include, indexOf, merge, starts;
var __hasProp = Object.prototype.hasOwnProperty;
if (!(typeof process !== "undefined" && process !== null)) {
this.exports = this;
@ -25,6 +25,11 @@
helpers.starts = (starts = function(string, literal, start) {
return string.substring(start, (start || 0) + literal.length) === literal;
});
helpers.ends = (ends = function(string, literal, back) {
var start;
start = string.length - literal.length - ((typeof back !== "undefined" && back !== null) ? back : 0);
return string.substring(start, start + literal.length) === literal;
});
helpers.compact = (compact = function(array) {
var _a, _b, _c, _d, item;
_a = []; _c = array;