From 1e3b8ff283851f209bc5a810b5805b30287bc255 Mon Sep 17 00:00:00 2001 From: Po-Hsien Chu Date: Fri, 11 Nov 2016 22:28:31 +0800 Subject: [PATCH] pass the whole words array to mapping functions --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index ffae380..8da13b6 100644 --- a/index.js +++ b/index.js @@ -36,14 +36,14 @@ module.exports = function() { n = words.length, i = -1, tags = [], - data = words.map(function(d, i) { - d.text = text.call(this, d, i); - d.font = font.call(this, d, i); - d.style = fontStyle.call(this, d, i); - d.weight = fontWeight.call(this, d, i); - d.rotate = rotate.call(this, d, i); - d.size = ~~fontSize.call(this, d, i); - d.padding = padding.call(this, d, i); + data = words.map(function(d, i, words) { + d.text = text.call(this, d, i, words); + d.font = font.call(this, d, i, words); + d.style = fontStyle.call(this, d, i, words); + d.weight = fontWeight.call(this, d, i, words); + d.rotate = rotate.call(this, d, i, words); + d.size = ~~fontSize.call(this, d, i, words); + d.padding = padding.call(this, d, i, words); return d; }).sort(function(a, b) { return b.size - a.size; });