diff --git a/client/modules/operation/format.js b/client/modules/operation/format.mjs similarity index 63% rename from client/modules/operation/format.js rename to client/modules/operation/format.mjs index ffed26f4..c639799e 100644 --- a/client/modules/operation/format.js +++ b/client/modules/operation/format.mjs @@ -1,6 +1,4 @@ -'use strict'; - -module.exports = (operation, from, to) => { +export const format = (operation, from, to) => { if (!to) return `${operation} ${from}`; diff --git a/client/modules/operation/get-next-current-name.js b/client/modules/operation/get-next-current-name.mjs similarity index 76% rename from client/modules/operation/get-next-current-name.js rename to client/modules/operation/get-next-current-name.mjs index d0f120d5..63445888 100644 --- a/client/modules/operation/get-next-current-name.js +++ b/client/modules/operation/get-next-current-name.mjs @@ -1,11 +1,9 @@ -'use strict'; - -const currify = require('currify'); +import currify from 'currify'; const not = currify((array, value) => !array.includes(value)); const notOneOf = currify((a, b) => a.filter(not(b))); -module.exports = (currentName, names, removedNames) => { +export const getNextCurrentName = (currentName, names, removedNames) => { const i = names.indexOf(currentName); const nextNames = notOneOf(names, removedNames); diff --git a/client/modules/operation/index.mjs b/client/modules/operation/index.mjs index 8e8149e5..a2e7c0e7 100644 --- a/client/modules/operation/index.mjs +++ b/client/modules/operation/index.mjs @@ -5,9 +5,9 @@ import exec from 'execon'; import load from 'load.js'; import {tryToCatch} from 'try-to-catch'; import {encode} from '../../../common/entity.js'; -import removeExtension from './remove-extension.js'; +import {removeExtension} from './remove-extension.mjs'; import {setListeners} from './set-listeners.mjs'; -import getNextCurrentName from './get-next-current-name.js'; +import {getNextCurrentName} from './get-next-current-name.mjs'; const {DOM, CloudCmd} = globalThis; diff --git a/client/modules/operation/remove-extension.js b/client/modules/operation/remove-extension.mjs similarity index 75% rename from client/modules/operation/remove-extension.js rename to client/modules/operation/remove-extension.mjs index 9aee274d..e6ce2c46 100644 --- a/client/modules/operation/remove-extension.js +++ b/client/modules/operation/remove-extension.mjs @@ -1,8 +1,6 @@ -'use strict'; +import {getExt} from '#common/util'; -const {getExt} = require('#common/util'); - -module.exports = (name) => { +export const removeExtension = (name) => { const ext = getExtension(name); return name.replace(ext, ''); diff --git a/client/modules/operation/remove-extension.spec.js b/client/modules/operation/remove-extension.spec.mjs similarity index 87% rename from client/modules/operation/remove-extension.spec.js rename to client/modules/operation/remove-extension.spec.mjs index 9896e735..8dbacb61 100644 --- a/client/modules/operation/remove-extension.spec.js +++ b/client/modules/operation/remove-extension.spec.mjs @@ -1,7 +1,5 @@ -'use strict'; - -const test = require('supertape'); -const removeExtension = require(`./remove-extension`); +import test from 'supertape'; +import {removeExtension} from './remove-extension.mjs'; test('cloudcmd: client: modules: operation: removeExtension: .tar.gz', (t) => { const name = 'hello'; diff --git a/client/modules/operation/set-listeners.mjs b/client/modules/operation/set-listeners.mjs index d5052cff..355aee79 100644 --- a/client/modules/operation/set-listeners.mjs +++ b/client/modules/operation/set-listeners.mjs @@ -1,7 +1,7 @@ /* global DOM */ import forEachKey from 'for-each-key'; import wraptile from 'wraptile'; -import format from './format.js'; +import {format} from './format.mjs'; const {Dialog, Images} = DOM;