From c61a0cdd228803282a738551a2695ca67dbba816 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 6 Dec 2013 19:34:16 -0800 Subject: [PATCH] Cleanup `_.compact` optimization. --- lodash.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lodash.js b/lodash.js index fbb814194..e442c820b 100644 --- a/lodash.js +++ b/lodash.js @@ -4501,13 +4501,13 @@ function compact(array) { var index = -1, length = array ? array.length : 0, - result = [], - cur = 0, - value; + resIndex = 0, + result = []; while (++index < length) { - if (value = array[index]) { - result[cur++] = value; + var value = array[index]; + if (value) { + result[resIndex++] = value; } } return result;