env-editor
Advanced tools
Comparing version 0.3.0 to 0.3.1
22
index.js
@@ -79,4 +79,6 @@ 'use strict'; | ||
const get = input => { | ||
input = input.toLowerCase().trim(); | ||
const bin = input.split(path.sep).pop(); | ||
input = input.trim(); | ||
const needle = input.toLowerCase(); | ||
const id = needle.split(/[/\\]/).pop().replace(/\s/g, '-'); | ||
const bin = id.split('-')[0]; | ||
@@ -86,4 +88,4 @@ for (const editor of editors()) { | ||
if ( | ||
input === editor.id || | ||
input === editor.name.toLowerCase() || | ||
needle === editor.id || | ||
needle === editor.name.toLowerCase() || | ||
bin === editor.bin | ||
@@ -95,3 +97,3 @@ ) { | ||
for (const p of editor.paths) { | ||
if (path.normalize(input) === path.normalize(p)) { | ||
if (path.normalize(needle) === path.normalize(p)) { | ||
return editor; | ||
@@ -102,3 +104,3 @@ } | ||
for (const keyword of editor.keywords) { | ||
if (input === keyword) { | ||
if (needle === keyword) { | ||
return editor; | ||
@@ -110,6 +112,8 @@ } | ||
return { | ||
id: input, | ||
id, | ||
name: input, | ||
bin: input, | ||
paths: [] | ||
bin, | ||
isTerminalEditor: false, | ||
paths: [], | ||
keywords: [] | ||
}; | ||
@@ -116,0 +120,0 @@ }; |
{ | ||
"name": "env-editor", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Get info about the default editor or a specific editor", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5640
124