mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
feature: cloudcmd: migrate to ESM
This commit is contained in:
parent
e8a81c49ea
commit
4533a25c6f
184 changed files with 339 additions and 388 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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 [
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue