JavaScript
Create an array if not already done

by Benny Neugebauer

const _ = require('lodash');

const ids = '123';
const array = _.isArray(ids) ? ids : [ids];

console.log('Output', array); // ["123"]

const ids = '123';
const array = [].concat(ids);

console.log('Output', array); // ["123"]