JSPM

npm-array-unique

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q30937F
  • License MIT

Receives array as an input and returns the unique array and also an object whith array items and their occurences

Package Exports

  • npm-array-unique

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npm-array-unique) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm-array-unique

Receives array as an input and returns the unique array and also an object whith array items and their occurences

Installation

npm i npm-array-unique

Usage

var arrayUnique = require('npm-array-unique');

unique(array)

Receives the input array and returns the unique array

    var arrayUnique = require('npm-array-unique')
    var inputArray = [1,2,3,4,3,2,4,3,4,5,4,5,5];
    
    arrayUnique.unique(inputArray);
    // [ 1, 2, 3, 4, 5]
    
    
    var inputArray2 = ['one', 5, 'two', 'three', 5, 'one', 'three', 7];
    
    arrayUnique.unique(inputArray2);
    // ['one', 5, 'two','three', 7];
  

uniqueCount(text)

Receives the input array and returns the unique array

  var arrayUnique = require('npm-array-unique')
  var inputArray = [1,2,3,4,4,4,4,5,6,7,7,8,8,8];
 
  arrayUnique.uniqueCount(inputArray);
  // { '1': 1, '2': 1, '3': 1, '4': 4, '5': 1, '6': 1, '7': 2, '8': 3 }
 
  

itemCount(text)

Receives the input array and returns the unique array

  var arrayUnique = require('npm-array-unique')
  var inputArray = [1,2,3,4,2,3,4,2,3,4,5,6,7,8,9,0,6,7,8,9];
 
  arrayUnique.itemCount(inputArray, 7);
  // 2
  

Demo

Demo @npm-array-unique | https://tonicdev.com/npm/npm-array-unique

Author

Krishcdbry [krishcdbry@gmail.com]

Licence

MIT @krishcdbry