<commit_before>---
title: Uniquify a two dimensional array
date: '2017-10-02T15:04:24-04:00'
tags:
  - javascript
  - array
---
Use the following function to get non-duplicate version of a two-dimensional​ array

```js
const unique = (arr) => {
  let map = {}
  return arr.filter(item => {
    if (item in map) return false
    else {
      map[item] = true
      return true
    }
  })
}

uique([[1,2], [1,2]]) 
//=> [[1,2]
```



<commit_msg>Update Notes “2017-10-02-uniquify-a-two-dimensional-array”<commit_after>---
title: Uniquify a two dimensional array
date: '2017-10-02T15:04:24-04:00'
tags:
  - javascript
  - array
---
Use the following function to get non-duplicate version of a two-dimensional​ array

```js
const unique = (arr) => {
  let map = {}
  return arr.filter(item => {
    if (item in map) return false
    else {
      map[item] = true
      return true
    }
  })
}

uique([[1,2], [1,2]]) 
//=> [[1,2]]
```





{'fraction_non_alphanumeric': 0.16898395721925133, 'fraction_numerical': 0.059893048128342244, 'mean_word_length': 2.7590361445783134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116329', 'n_tokens_mistral': 383, 'n_tokens_neox': 345, 'n_words': 94}