{"id":21177549,"url":"https://github.com/grjan7/deduplicate-array","last_synced_at":"2026-04-11T21:44:55.138Z","repository":{"id":60024363,"uuid":"540132465","full_name":"grjan7/deduplicate-array","owner":"grjan7","description":"Returns duplicates-removed array -- has options for case-sensitivity and strict-typing.","archived":false,"fork":false,"pushed_at":"2023-01-04T06:16:46.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T14:20:34.781Z","etag":null,"topics":["array","deduplicate","javascript","json","nodejs","npm","npm-package","objects","unique"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grjan7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-22T19:10:45.000Z","updated_at":"2023-02-27T07:37:37.000Z","dependencies_parsed_at":"2023-02-02T01:01:56.838Z","dependency_job_id":null,"html_url":"https://github.com/grjan7/deduplicate-array","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fdeduplicate-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fdeduplicate-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fdeduplicate-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grjan7%2Fdeduplicate-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grjan7","download_url":"https://codeload.github.com/grjan7/deduplicate-array/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243624856,"owners_count":20321180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","deduplicate","javascript","json","nodejs","npm","npm-package","objects","unique"],"created_at":"2024-11-20T17:16:25.696Z","updated_at":"2026-04-11T21:44:50.093Z","avatar_url":"https://github.com/grjan7.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deduplicate-array\n\n[![NPM version](https://img.shields.io/npm/v/deduplicate-array.svg)](https://www.npmjs.com/package/deduplicate-array)\n[![NPM downloads](https://img.shields.io/npm/dm/deduplicate-array.svg)](https://www.npmjs.com/package/deduplicate-array)\n[![Known Vulnerabilities](https://snyk.io/test/github/grjan7/deduplicate-array/badge.svg)](https://snyk.io/test/github/grjan7/deduplicate-array)\n\n## Description\n\n\u003e This package removes duplicate values (Type: string | number | boolean | null | undefined | object | array) from the array (`sourceArray`). This is case-sensitive and strictly typed by default, but can be optimised with `opts`.\n\n## Install\n\n```sh\n\n  npm i deduplicate-array\n\n```\n\n### Usage\n\n#### `deduplicateArray(sourceArray, opts)`\n\n  - **sourceArray** | datatype: array | required\n\n  - **opts** | datatype: object | optional\n\n  - **opts.caseSensitive** | datatype: boolean | optional | default: true\n\n  - **opts.strictType** | datatype: boolean | optional | default: true\n\n##### Example 1: String with no options\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [\"A\", \"a\", \"b\", \"c\", \"d\", \"a\", \"d\"];\n\n  deduplicateArray(arr);\n\n  //returns [\"A\", \"a\", \"b\", \"c\", \"d\"]\n\n```\n\n##### Example 2: String with option | `caseSensitive: false`\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [\"A\", \"a\", \"b\", \"c\", \"d\", \"a\", \"d\"];\n  const opts = { caseSensitive: false }\n\n  deduplicateArray(arr, opts);\n\n  //returns [\"A\", \"b\", \"c\", \"d\"]\n\n```\n\n##### Example 3: Number with no options\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [\"10\", 10, \"10\"];\n\n  deduplicateArray(arr);\n\n  //returns [\"10\", 10]\n\n```\n\n##### Example 4: Number with option | `strictType: false`\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [\"10\", 10, \"10\"];\n  const opts = { strictType: false }\n\n  deduplicateArray(arr, opts);\n\n  //returns [\"10\"]\n\n```\n\n##### Example 5: Object with no options\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [{name: \"arun\"}, {name: \"Arun\"}, {name: \"arun\"}];\n\n  deduplicateArray(arr);\n```\nreturns\n\n```js\n[{name: \"arun\"}, {name: \"Arun\"}]\n```\n\n##### Example 6: Object with option | `caseSensitive: false`\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [{name: \"arun\"}, {name: \"Arun\"}, {name: \"arun\"}];\n  const opts = { caseSensitive: false }\n\n  deduplicateArray(arr, opts);\n```\nreturns\n\n```js\n   [{name: \"arun\"}]\n```\n\n##### Example 7: Array with no option\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [[\"arun\", \"John\"], [\"Arun\", \"john\"], [\"arun\", \"John\"]];  \n\n  deduplicateArray(arr);\n\n```\nreturns\n\n```js\n   [[\"arun\", \"John\"], [\"Arun\", \"john\"]]\n```\n\n##### Example 8: Array with option | `caseSensitive: false`\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [[\"arun\", \"John\"], [\"Arun\", \"john\"], [\"arun\", \"John\"]];\n  const opts = { caseSensitive: false }\n\n  deduplicateArray(arr, opts);\n\n```\nreturns\n\n```js\n   [[\"arun\", \"John\"]]\n```\n\n##### Example 9: Array with option | `caseSensitive: false`\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [[\"arun\", \"10\"], [\"Arun\", 10], [\"arun\", 10]];\n  const opts = { caseSensitive: false }\n\n  deduplicateArray(arr, opts);\n  \n```\nreturns\n\n```js\n   [[\"arun\", \"10\"], [\"Arun\", 10]]\n```\n\n##### Example 10: Array with option | `caseSensitive: false | strictType: false`\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr = [[\"arun\", \"10\"], [\"Arun\", 10], [\"arun\", 10]];\n  const opts = { caseSensitive: false, strictType: false }\n\n  deduplicateArray(arr, opts);\n  \n```\nreturns\n\n```js\n   [[\"arun\", \"10\"]]\n```\n\n##### Example 11: Boolean with no option\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr =  [true, true, false, true, false];  \n\n  deduplicateArray(arr); \n  \n  // returns [true, false]\n\n```\n\n##### Example 12: Null with no option\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr =  [null, true, false, null, false];  \n\n  deduplicateArray(arr); \n  \n  // returns [null, true, false]\n\n```\n\n##### Example 13: Undefined with no option\n\n```js\n\n  const deduplicateArray = require('deduplicate-array');\n\n  const arr =  [true, undefined, false, null, false];  \n\n  deduplicateArray(arr); \n  \n  // returns [true, undefined, false, null]\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrjan7%2Fdeduplicate-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrjan7%2Fdeduplicate-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrjan7%2Fdeduplicate-array/lists"}