Advertisement
Guest User

Untitled

a guest
Feb 24th, 2015
2,584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. "use strict"
  3.  
  4. function unique_pred(list, compare) {
  5.   var ptr = 1
  6.     , len = list.length
  7.     , a=list[0], b=list[0]
  8.   for(var i=1; i<len; ++i) {
  9.     b = a
  10.     a = list[i]
  11.     if(compare(a, b)) {
  12.       if(i === ptr) {
  13.         ptr++
  14.         continue
  15.       }
  16.       list[ptr++] = a
  17.     }
  18.   }
  19.   list.length = ptr
  20.   return list
  21. }
  22.  
  23. function unique_eq(list) {
  24.   var ptr = 1
  25.     , len = list.length
  26.     , a=list[0], b = list[0]
  27.   for(var i=1; i<len; ++i, b=a) {
  28.     b = a
  29.     a = list[i]
  30.     if(a !== b) {
  31.       if(i === ptr) {
  32.         ptr++
  33.         continue
  34.       }
  35.       list[ptr++] = a
  36.     }
  37.   }
  38.   list.length = ptr
  39.   return list
  40. }
  41.  
  42. function unique(list, compare, sorted) {
  43.   if(list.length === 0) {
  44.     return list
  45.   }
  46.   if(compare) {
  47.     if(!sorted) {
  48.       list.sort(compare)
  49.     }
  50.     return unique_pred(list, compare)
  51.   }
  52.   if(!sorted) {
  53.     list.sort()
  54.   }
  55.   return unique_eq(list)
  56. }
  57.  
  58. module.exports = unique
  59.  
  60. },{}],2:[function(require,module,exports){
  61. var unique = require('uniq');
  62. },{"uniq":1}]},{},[2]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement