refactor(gui): linting

Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com>
This commit is contained in:
Pranav C
2021-07-19 16:30:37 +05:30
parent f9508c2d44
commit fa00be39b8
303 changed files with 34924 additions and 31761 deletions

View File

@@ -1,10 +1,9 @@
export default function isDev() {
export default function isDev () {
return process.env.NODE_ENV &&
(process.env.NODE_ENV.toLowerCase() === 'development' || process.env.NODE_ENV.toLowerCase() === 'dev');
(process.env.NODE_ENV.toLowerCase() === 'development' || process.env.NODE_ENV.toLowerCase() === 'dev')
}
export function isMetaTable(tn) {
export function isMetaTable (tn) {
return [
'_evolutions',
'nc_models',
@@ -33,25 +32,24 @@ export function isMetaTable(tn) {
'xc_users',
'nc_plugins',
'nc_disabled_models_for_role'
].includes(tn);
].includes(tn)
}
export function insertKey(key, value, obj, pos) {
const keys = Object.keys(obj);
export function insertKey (key, value, obj, pos) {
const keys = Object.keys(obj)
if (!keys.length || pos > keys.length - 1) {
obj[key] = value;
return obj;
obj[key] = value
return obj
}
return keys.reduce((ac, a, i) => {
if (i === pos) ac[key] = value;
ac[a] = obj[a];
return ac;
if (i === pos) { ac[key] = value }
ac[a] = obj[a]
return ac
}, {})
}
export function copyTextToClipboard(text) {
var textArea = document.createElement("textarea");
export function copyTextToClipboard (text) {
const textArea = document.createElement('textarea')
//
// *** This styling is an extra step which is likely not required. ***
@@ -70,42 +68,41 @@ export function copyTextToClipboard(text) {
//
// Place in top-left corner of screen regardless of scroll position.
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.position = 'fixed'
textArea.style.top = 0
textArea.style.left = 0
// Ensure it has a small width and height. Setting to 1px / 1em
// doesn't work as this gives a negative w/h on some browsers.
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.width = '2em'
textArea.style.height = '2em'
// We don't need padding, reducing the size if it does flash render.
textArea.style.padding = 0;
textArea.style.padding = 0
// Clean up any borders.
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
textArea.style.border = 'none'
textArea.style.outline = 'none'
textArea.style.boxShadow = 'none'
// Avoid flash of white box if rendered for any reason.
textArea.style.background = 'transparent';
textArea.style.background = 'transparent'
textArea.value = text
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
document.body.appendChild(textArea)
textArea.focus()
textArea.select()
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
const successful = document.execCommand('copy')
const msg = successful ? 'successful' : 'unsuccessful'
console.log('Copying text command was ' + msg)
} catch (err) {
console.log('Oops, unable to copy');
console.log('Oops, unable to copy')
}
document.body.removeChild(textArea);
document.body.removeChild(textArea)
}
/**