Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dropped coloredInterpolation option due to incompatibility with Nod…
…e `<v10.0.0`
  • Loading branch information
klaudiosinani committed Feb 17, 2019
1 parent 65a1dd4 commit 5f3684f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -43,7 +43,6 @@
},
"options": {
"default": {
"coloredInterpolation": false,
"displayScope": true,
"displayBadge": true,
"displayDate": false,
Expand Down
8 changes: 0 additions & 8 deletions readme.md
Expand Up @@ -362,7 +362,6 @@ The following illustrates all the available options with their respective defaul
```json
{
"signale": {
"coloredInterpolation": false,
"displayScope": true,
"displayBadge": true,
"displayDate": false,
Expand All @@ -381,13 +380,6 @@ The following illustrates all the available options with their respective defaul
<details>
<summary>View all of the available options in detail.</summary>

##### `coloredInterpolation`

- Type: `Boolean`
- Default: `false`

Display the arguments, which replace the placeholder tokens on string interpolation, colored.

##### `displayScope`

- Type: `Boolean`
Expand Down
26 changes: 6 additions & 20 deletions signale.js
Expand Up @@ -133,22 +133,8 @@ class Signale {
return `[${this.timestamp}]`;
}

_formatMessage(str, type) {
str = this._arrayify(str);

if (this._config.coloredInterpolation) {
const _ = Object.assign({}, util.inspect.styles);

Object.keys(util.inspect.styles).forEach(x => {
util.inspect.styles[x] = type.color || _[x];
});

str = util.formatWithOptions({colors: true}, ...str);
util.inspect.styles = Object.assign({}, _);
return str;
}

return util.format(...str);
_formatMessage(str) {
return util.format(...this._arrayify(str));
}

_meta() {
Expand Down Expand Up @@ -178,8 +164,8 @@ class Signale {
return meta;
}

_hasAdditional({suffix, prefix}, args, type) {
return (suffix || prefix) ? '' : this._formatMessage(args, type);
_hasAdditional({suffix, prefix}, args) {
return (suffix || prefix) ? '' : this._formatMessage(args);
}

_buildSignale(type, ...args) {
Expand All @@ -191,10 +177,10 @@ class Signale {
} else {
const [{prefix, message, suffix}] = args;
additional = Object.assign({}, {suffix, prefix});
msg = message ? this._formatMessage(message, type) : this._hasAdditional(additional, args, type);
msg = message ? this._formatMessage(message) : this._hasAdditional(additional, args);
}
} else {
msg = this._formatMessage(args, type);
msg = this._formatMessage(args);
}

const signale = this._meta();
Expand Down

0 comments on commit 5f3684f

Please sign in to comment.