7 exports.extend = require('extend-shallow');
8 exports.SourceMap = require('source-map');
9 exports.sourceMapResolve = require('source-map-resolve');
12 * Convert backslash in the given string to forward slashes
15 exports.unixify = function(fp) {
16 return fp.split(/\\+/).join('/');
20 * Return true if `val` is a non-empty string
22 * @param {String} `str`
26 exports.isString = function(str) {
27 return str && typeof str === 'string';
31 * Cast `val` to an array
35 exports.arrayify = function(val) {
36 if (typeof val === 'string') return [val];
37 return val ? (Array.isArray(val) ? val : [val]) : [];
41 * Get the last `n` element from the given `array`
42 * @param {Array} `array`
46 exports.last = function(arr, n) {
47 return arr[arr.length - (n || 1)];