Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sindresorhus/array-uniq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.1.0
Choose a base ref
...
head repository: sindresorhus/array-uniq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0
Choose a head ref
  • 5 commits
  • 11 files changed
  • 3 contributors

Commits on Apr 26, 2019

  1. Add Node.js 12 to testing (#12)

    coreyfarrell authored and sindresorhus committed Apr 26, 2019
    Copy the full SHA
    402de77 View commit details

Commits on May 31, 2019

  1. Tidelift tasks

    sindresorhus committed May 31, 2019
    Copy the full SHA
    ea72871 View commit details

Commits on Jan 1, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cc9b081 View commit details

Commits on May 3, 2021

  1. Copy the full SHA
    f6c4c20 View commit details
  2. 3.0.0

    sindresorhus committed May 3, 2021
    Copy the full SHA
    42335f5 View commit details
Showing with 57 additions and 33 deletions.
  1. +2 −0 .github/funding.yml
  2. +3 −0 .github/security.md
  3. +22 −0 .github/workflows/main.yml
  4. +0 −5 .travis.yml
  5. +2 −6 index.d.ts
  6. +3 −5 index.js
  7. +1 −1 index.test-d.ts
  8. +1 −1 license
  9. +9 −6 package.json
  10. +13 −8 readme.md
  11. +1 −1 test.js
2 changes: 2 additions & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: sindresorhus
tidelift: npm/array-uniq
3 changes: 3 additions & 0 deletions .github/security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI
on:
- push
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 16
- 14
- 12
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

8 changes: 2 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ Create an array without duplicates.
@example
```
import arrayUniq = require('array-uniq');
import arrayUniq from 'array-uniq';
arrayUniq([1, 1, 2, 3, 3]);
//=> [1, 2, 3]
@@ -14,8 +14,4 @@ arrayUniq(['foo', 'foo', 'bar', 'foo']);
//=> ['foo', 'bar']
```
*/
declare function arrayUniq<ValueType>(
array: ReadonlyArray<ValueType>
): ValueType[];

export = arrayUniq;
export default function arrayUniq<ValueType>(array: readonly ValueType[]): ValueType[];
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const arrayUniq = array => [...new Set(array)];

module.exports = arrayUniq;
export default function arrayUniq(array) {
return [...new Set(array)];
}
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expectType} from 'tsd';
import arrayUniq = require('.');
import arrayUniq from './index.js';

expectType<number[]>(arrayUniq([1, 2, 3]));
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"name": "array-uniq",
"version": "2.1.0",
"version": "3.0.0",
"description": "Create an array without duplicates",
"license": "MIT",
"repository": "sindresorhus/array-uniq",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=6"
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
@@ -28,8 +31,8 @@
"remove"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.39.1"
}
}
21 changes: 13 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq)
# array-uniq

> Create an array without duplicates

## Install

```
$ npm install array-uniq
```


## Usage

```js
const arrayUniq = require('array-uniq');
import arrayUniq from 'array-uniq';

arrayUniq([1, 1, 2, 3, 3]);
//=> [1, 2, 3]
@@ -22,7 +20,14 @@ arrayUniq(['foo', 'foo', 'bar', 'foo']);
//=> ['foo', 'bar']
```


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
---

<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-array-uniq?utm_source=npm-array-uniq&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import arrayUniq from '.';
import arrayUniq from './index.js';

test('main', t => {
t.deepEqual(arrayUniq([1, 2, 2, 3, 1, 2, 4]), [1, 2, 3, 4]);