Skip to content

Commit

Permalink
fix: prevent this context conflicts;
Browse files Browse the repository at this point in the history
- Closes #19
  • Loading branch information
lukeed committed Feb 7, 2019
1 parent 59d7d74 commit 3d3a4cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;

const $ = {
Expand Down Expand Up @@ -90,7 +92,7 @@ function chain(keys) {

function init(key) {
return function (txt) {
let isChain = !!this.keys;
let isChain = this !== void 0 && !!this.keys;
if (isChain) this.keys.includes(key) || this.keys.push(key);
if (txt !== void 0) return $.enabled ? run(isChain ? this.keys : [key], txt+'') : txt+'';
return isChain ? this : chain([key]);
Expand Down

0 comments on commit 3d3a4cb

Please sign in to comment.