pure-array usage Work for array object const { Pure } = require('pure-array'); const yourArray = [1, 2, 3]; // try add existed number or doesn't console.log(Pure(yourArray, 3)) It's still initial version, i just test for Array of number and Array of string