🎨 Updated prettier config
This commit is contained in:
parent
b8e632998b
commit
6710d76b08
401 changed files with 13193 additions and 15620 deletions
|
@ -1,47 +1,48 @@
|
|||
import { version, name } from "../package.json";
|
||||
import { version, name } from '../package.json'
|
||||
|
||||
const colors = {
|
||||
info: "RoyalBlue",
|
||||
warning: "Tomato",
|
||||
error: "Red",
|
||||
success: "OliveDrab",
|
||||
debug: "Magenta"
|
||||
};
|
||||
info: 'RoyalBlue',
|
||||
warning: 'Tomato',
|
||||
error: 'Red',
|
||||
success: 'OliveDrab',
|
||||
debug: 'Magenta'
|
||||
}
|
||||
|
||||
var debug = {
|
||||
name,
|
||||
version
|
||||
};
|
||||
}
|
||||
|
||||
debug.log = function(label="", style="", data="") {
|
||||
debug.log = function(label = '', style = '', data = '') {
|
||||
// This allows us to stub console.log()
|
||||
// in unit tests without side-effects
|
||||
console.log(label, style, data);
|
||||
};
|
||||
console.log(label, style, data)
|
||||
}
|
||||
|
||||
debug.style = function(type) {
|
||||
return `font-weight: bold; padding: 0 5px; color: ${colors[type]};`;
|
||||
return `font-weight: bold; padding: 0 5px; color: ${colors[type]};`
|
||||
}
|
||||
|
||||
debug.hooks = {
|
||||
preRender: function(svg) {
|
||||
if(svg.attributes.get("freesewing:plugin-debug") === false) {
|
||||
svg.attributes.set("freesewing:plugin-debug", version);
|
||||
if (svg.attributes.get('freesewing:plugin-debug') === false) {
|
||||
svg.attributes.set('freesewing:plugin-debug', version)
|
||||
}
|
||||
},
|
||||
debug: function(data, more) {
|
||||
if(
|
||||
typeof data === "object" &&
|
||||
typeof data.type === "string" &&
|
||||
typeof data.label === "string" &&
|
||||
typeof data.msg !== "undefined" &&
|
||||
Object.keys(data).length === 3) {
|
||||
if (
|
||||
typeof data === 'object' &&
|
||||
typeof data.type === 'string' &&
|
||||
typeof data.label === 'string' &&
|
||||
typeof data.msg !== 'undefined' &&
|
||||
Object.keys(data).length === 3
|
||||
) {
|
||||
// Make it pretty
|
||||
debug.log("%c"+data.label, debug.style(data.type), data.msg);
|
||||
debug.log('%c' + data.label, debug.style(data.type), data.msg)
|
||||
} else {
|
||||
debug.log("%cdebug", debug.style('debug'), data);
|
||||
debug.log('%cdebug', debug.style('debug'), data)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default debug;
|
||||
export default debug
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue