Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 327 Bytes

File metadata and controls

15 lines (11 loc) · 327 Bytes

shell-expand

Expand shell-style variable substitution

Usage

Currently it works for flat input (1-depth) only and returns the result split by a given IFS string (defaults to " \t\n").

const vars = {
  TEST: '$TEST $TEST'
};
console.log(shellExpand('${TEST}', vars, { IFS: ' ' })); // ["$TEST", "$TEST"]