Version 1
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / _baseSortedUniqBy.js
diff --git a/node_modules/grunt-legacy-log-utils/node_modules/lodash/_baseSortedUniqBy.js b/node_modules/grunt-legacy-log-utils/node_modules/lodash/_baseSortedUniqBy.js
new file mode 100644 (file)
index 0000000..c95a83f
--- /dev/null
@@ -0,0 +1,33 @@
+var eq = require('./eq');
+
+/**
+ * The base implementation of `_.sortedUniqBy` without support for iteratee
+ * shorthands.
+ *
+ * @private
+ * @param {Array} array The array to inspect.
+ * @param {Function} [iteratee] The iteratee invoked per element.
+ * @returns {Array} Returns the new duplicate free array.
+ */
+function baseSortedUniqBy(array, iteratee) {
+  var index = 0,
+      length = array.length,
+      value = array[0],
+      computed = iteratee ? iteratee(value) : value,
+      seen = computed,
+      resIndex = 0,
+      result = [value];
+
+  while (++index < length) {
+    value = array[index],
+    computed = iteratee ? iteratee(value) : value;
+
+    if (!eq(computed, seen)) {
+      seen = computed;
+      result[++resIndex] = value;
+    }
+  }
+  return result;
+}
+
+module.exports = baseSortedUniqBy;