feature: cloudcmd: migrate to ESM

This commit is contained in:
coderiaser 2026-02-03 15:03:49 +02:00
parent e8a81c49ea
commit 4533a25c6f
184 changed files with 339 additions and 388 deletions

View file

@ -1,8 +1,6 @@
'use strict';
const success = (f) => (data) => f(null, data);
module.exports = (promise) => (...a) => {
export default (promise) => (...a) => {
const fn = a.pop();
promise(...a)

View file

@ -1,11 +1,7 @@
'use strict';
const {promisify} = require('node:util');
const {tryToCatch} = require('try-to-catch');
const {test, stub} = require('supertape');
const callbackify = require('./callbackify');
import {promisify} from 'node:util';
import {tryToCatch} from 'try-to-catch';
import {test, stub} from 'supertape';
import callbackify from './callbackify.js';
test('cloudcmd: common: callbackify: error', async (t) => {
const promise = stub().rejects(Error('hello'));

View file

@ -1,8 +1,6 @@
'use strict';
import shortdate from 'shortdate';
const shortdate = require('shortdate');
module.exports = (date) => {
export default (date) => {
date = date || new Date();
check(date);

View file

@ -1,9 +1,6 @@
'use strict';
const {test} = require('supertape');
const {tryCatch} = require('try-catch');
const datetime = require('./datetime');
import {test} from 'supertape';
import {tryCatch} from 'try-catch';
import datetime from './datetime.js';
test('common: datetime', (t) => {
const dateStr = 'Fri, 17 Aug 2018 10:56:48';

View file

@ -1,9 +1,8 @@
'use strict';
import {tryToCatch} from 'try-to-catch';
const {tryToCatch} = require('try-to-catch');
const all = Promise.all.bind(Promise);
module.exports = async (a) => {
export default async (a) => {
const [e, result = []] = await tryToCatch(all, a);
return [

View file

@ -1,7 +1,5 @@
'use strict';
const {test} = require('supertape');
const tryToPromiseAll = require('./try-to-promise-all');
import {test} from 'supertape';
import tryToPromiseAll from './try-to-promise-all.js';
const resolve = Promise.resolve.bind(Promise);
const reject = Promise.reject.bind(Promise);