Coder Social home page Coder Social logo

array-uniq's Introduction

array-uniq's People

Contributors

amitport avatar bendingbender avatar coreyfarrell avatar dy avatar richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

array-uniq's Issues

Can you support compare

Give a function to determine whether the two is same, especially for object in array

uniq([{a: 1}, {a: 1}], function(a, b) {
  return a.a === b.a;
})

Separate 3 implementations in their own modules?

Separating 3 implementations in their own modules would make smaller builds when using Browserify and trying to support older browsers which don’t have Set.

For example:

var uniq = require('arr-uniq/no-set');

And in index.js you would export required module.

Is this something you are willing to implement (or accept as PR)?

Typings for module

I'm going to use your module in application node+typescript.
What about *.d.ts file for 'array-uniq'?
Is it possible to add typings?

error with node v0.10.29

@sindresorhus I noticed follow error while using gulp-filter with basic example.
I am using node v0.10.29. I am also using traceur in node env, which may also provider some shim for Set. Wonder if anybody else seen this error?

undefined:1811
      for (var $__25 = iterable[Symbol.iterator](),
                                                ^
TypeError: Property 'Symbol()' of object  is not a function
  at new Set (<anonymous>:1811:49)
  at uniqSetWithForEach (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/multimatch/node_modules/array-union/node_modules/array-uniq/index.js:33:3)
  at module.exports (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/multimatch/node_modules/array-union/index.js:5:9)
  at /Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/multimatch/index.js:25:10
  at Array.reduce (native)
  at module.exports (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/multimatch/index.js:20:18)
  at Transform._transform (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/index.js:18:6)
  at Transform._read (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
  at Transform._write (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
  at doWrite (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:238:10)
  at writeOrBuffer (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:228:5)
  at Transform.Writable.write (/Developer/Work/spa-starter-kit/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:195:11)
  at write (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:605:24)
  at flow (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:614:7)
  at Transform.pipeOnReadable (/Developer/Work/spa-starter-kit/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:646:5)
  at Transform.emit (events.js:92:17)

Safari Set is broken

forEach in safari's Set is broken:

var set = new Set([1,2,3])
//undefined
set.forEach(function(el){console.log(el)})
//[1,2,3]
//not 1, 2, 3 as expected.

It doesn't know about creating set from array/iterable. (Safari 7.1).
So the whole array is passed as the first argument to forEach callback.

Possibly could check more precisely:

function doesForEachActuallyWork() {
    var ret = false;

    (new Set([true])).forEach(function (el) {
        ret = el;
    });

    return ret === true;
}

Update description on npm

"It's already pretty fast, but will be much faster when Set becomes available in V8 (especially with large arrays)."

Given that you are already depending on Node 6, probably this is kinda obsolete?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.