UNPKG

391 BJavaScriptView Raw
1var $, _;
2
3$ = {};
4
5$.type = require('../dist/type');
6
7_ = {};
8
9_.clone = require('lodash/clone');
10
11module.exports = function(arg) {
12 var type;
13 switch (type = $.type(arg)) {
14 case 'array':
15 return _.clone(arg);
16 case 'boolean':
17 case 'number':
18 case 'string':
19 return [arg];
20 default:
21 throw new Error(`formatArgument/error: invalid type '${type}'`);
22 }
23};