mindjs/mindjs

View on GitHub
packages/common/src/utils/array.utils.js

Summary

Maintainability
A
0 mins
Test Coverage
const { isArray } = require('lodash');

/**
 * Converts a value to array or returns it if it is an Array
 * @param value
 * @returns {*[]}
 */
function toArray(value) {
  return isArray(value) ? value : [value];
}

module.exports = {
  toArray
};