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:
parent
8c34aff1c5
commit
0b87387fab
5 changed files with 43 additions and 28 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue