mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(cloudcmd) drop support of node < 14
This commit is contained in:
parent
7371871f15
commit
c3339d8ea2
7 changed files with 12 additions and 9 deletions
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"rules": {
|
||||
"apply-optional-chaining": "on"
|
||||
},
|
||||
"ignore": [
|
||||
"fixture*",
|
||||
"dist*",
|
||||
|
|
|
|||
|
|
@ -638,7 +638,7 @@ function CmdProto() {
|
|||
if (!current)
|
||||
DOM.getCurrentFile();
|
||||
|
||||
const parent = current && current.parentElement;
|
||||
const parent = current?.parentElement;
|
||||
const name = DOM.getCurrentName(current);
|
||||
|
||||
if (current && name !== '..') {
|
||||
|
|
@ -685,7 +685,7 @@ function CmdProto() {
|
|||
|
||||
/* scroll on one page */
|
||||
this.scrollByPages = (element, pPages) => {
|
||||
const ret = element && element.scrollByPages && pPages;
|
||||
const ret = element?.scrollByPages && pPages;
|
||||
|
||||
if (ret)
|
||||
element.scrollByPages(pPages);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ function getPath(el, path = []) {
|
|||
|
||||
async function config() {
|
||||
const [, config] = await tryToCatch(DOM.Files.get, 'config');
|
||||
const type = config && config.packer;
|
||||
const type = config?.packer;
|
||||
|
||||
EXT = DOM.getPackerExt(type);
|
||||
}
|
||||
|
|
@ -461,7 +461,7 @@ function dragndrop() {
|
|||
function unload() {
|
||||
DOM.Events.add(['unload', 'beforeunload'], (event) => {
|
||||
const {Key} = CloudCmd;
|
||||
const isBind = Key && Key.isBind();
|
||||
const isBind = Key?.isBind();
|
||||
|
||||
if (isBind)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module.exports.registerSW = registerSW;
|
|||
module.exports.unregisterSW = unregisterSW;
|
||||
|
||||
module.exports.listenSW = (sw, ...args) => {
|
||||
sw && sw.addEventListener(...args);
|
||||
sw?.addEventListener(...args);
|
||||
};
|
||||
|
||||
async function registerSW(prefix) {
|
||||
|
|
@ -21,6 +21,6 @@ async function registerSW(prefix) {
|
|||
}
|
||||
async function unregisterSW(prefix) {
|
||||
const reg = await registerSW(prefix);
|
||||
reg && reg.unregister(prefix);
|
||||
reg?.unregister(prefix);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@
|
|||
"yaspeller": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
"node": ">=14"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "server/cloudcmd.js",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const getMessage = (a) => a && a.message || a;
|
||||
const getMessage = (a) => a?.message || a;
|
||||
|
||||
module.exports = (...args) => {
|
||||
const messages = args.map(getMessage);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ function rest(config, request, response) {
|
|||
if (options.query)
|
||||
params.query = options.query;
|
||||
|
||||
if (error && error.code)
|
||||
if (error?.code)
|
||||
return ponse.sendError(error, params);
|
||||
|
||||
if (error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue