Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const make = (files, options = {}) => {
if (!Array.isArray(files)) {
throw new TypeError(`Expected an \`Array\`, got ${typeof files}`);
}
const editor = options.editor ? envEditor.getEditor(options.editor) : envEditor.defaultEditor();
const editorArguments = [];
if (editor.id === 'vscode') {
editorArguments.push('--goto');
}
for (const file of files) {
const parsed = lineColumnPath.parse(file);
if (['sublime', 'atom', 'vscode'].includes(editor.id)) {
editorArguments.push(lineColumnPath.stringify(parsed));
continue;
}
if (['webstorm', 'intellij'].includes(editor.id)) {
editorArguments.push(lineColumnPath.stringify(parsed, {column: false}));
continue;
}
if (editor.id === 'textmate') {
editorArguments.push('--line', lineColumnPath.stringify(parsed, {
file: false
}), parsed.file);
continue;