How to use the web-ext-native-msg.getFileNameFromFilePath function in web-ext-native-msg

To help you get started, we’ve selected a few web-ext-native-msg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asamuzaK / withExEditorHost / modules / main.js View on Github external
const exportEditorConfig = async (data, editorConfigPath) => {
  if (!isString(data)) {
    throw new TypeError(`Expected String but got ${getType(data)}.`);
  }
  let func;
  data = data && JSON.parse(data);
  if (isObjectNotEmpty(data)) {
    const {editorPath} = data;
    const editorName = await getFileNameFromFilePath(editorPath);
    const executable = isExecutable(editorPath);
    const timestamp = await getFileTimestamp(editorConfigPath);
    const reg =
      new RegExp(`\\$(?:${TMP_FILE_PLACEHOLDER}|{${TMP_FILE_PLACEHOLDER}})`);
    const keys = Object.keys(editorConfig);
    for (const key of keys) {
      const value = data[key];
      if (key === "editorPath") {
        editorConfig[key] = value;
      }
      if (key === "cmdArgs") {
        editorConfig[key] = new CmdArgs(value).toArray();
        editorConfig.hasPlaceholder = reg.test(value);
      }
    }
    const msg = {