mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
chore(client) convert to esm
This commit is contained in:
parent
d475790257
commit
18dc5d3a4c
91 changed files with 587 additions and 805 deletions
|
|
@ -1,6 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
const currify = require('currify');
|
||||
import currify from 'currify';
|
||||
|
||||
const isType = currify((type, object, name) => {
|
||||
return typeof object[name] === type;
|
||||
|
|
@ -8,16 +6,14 @@ const isType = currify((type, object, name) => {
|
|||
|
||||
const isBool = isType('boolean');
|
||||
|
||||
module.exports.getElementByName = getElementByName;
|
||||
|
||||
function getElementByName(selector, element) {
|
||||
export function getElementByName(selector, element) {
|
||||
const str = `[data-name="js-${selector}"]`;
|
||||
|
||||
return element
|
||||
.querySelector(str);
|
||||
}
|
||||
|
||||
module.exports.getName = (element) => {
|
||||
export const getName = (element) => {
|
||||
const name = element
|
||||
.getAttribute('data-name')
|
||||
.replace(/^js-/, '');
|
||||
|
|
@ -25,7 +21,7 @@ module.exports.getName = (element) => {
|
|||
return name;
|
||||
};
|
||||
|
||||
module.exports.convert = (config) => {
|
||||
export const convert = (config) => {
|
||||
const result = config;
|
||||
const array = Object.keys(config);
|
||||
|
||||
|
|
@ -46,7 +42,7 @@ function setState(state) {
|
|||
return '';
|
||||
}
|
||||
|
||||
module.exports.getValue = (name, element) => {
|
||||
export const getValue = (name, element) => {
|
||||
const el = getElementByName(name, element);
|
||||
const {type} = el;
|
||||
|
||||
|
|
@ -62,7 +58,7 @@ module.exports.getValue = (name, element) => {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports.setValue = (name, value, element) => {
|
||||
export const setValue = (name, value, element) => {
|
||||
const el = getElementByName(name, element);
|
||||
const {type} = el;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue