Comparing version 2.0.1 to 2.1.0
@@ -14,2 +14,4 @@ "use strict"; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
@@ -31,3 +33,3 @@ | ||
var _assert = _interopRequireDefault(require("../lib/utils/assert")); | ||
var _assert2 = _interopRequireDefault(require("../lib/utils/assert")); | ||
@@ -124,2 +126,7 @@ var originalConsole = { | ||
}, { | ||
key: "assert", | ||
value: function assert(condition, message) { | ||
(0, _assert2.default)(condition, message); | ||
} | ||
}, { | ||
key: "warn", | ||
@@ -261,2 +268,21 @@ value: function warn(message) { | ||
}, { | ||
key: "settings", | ||
value: function settings() { | ||
if (console.table) { | ||
console.table(this._storage.config); | ||
} else { | ||
console.log(this._storage.config); | ||
} | ||
} | ||
}, { | ||
key: "get", | ||
value: function get(setting) { | ||
return this._storage.config[setting]; | ||
} | ||
}, { | ||
key: "set", | ||
value: function set(setting, value) { | ||
this._storage.updateConfiguration((0, _defineProperty2.default)({}, setting, value)); | ||
} | ||
}, { | ||
key: "_logImageInNode", | ||
@@ -448,3 +474,3 @@ value: function _logImageInNode(_ref3) { | ||
opts = this._parseArguments(opts); | ||
(0, _assert.default)(method); | ||
(0, _assert2.default)(method); | ||
var _opts3 = opts, | ||
@@ -500,3 +526,3 @@ message = _opts3.message; | ||
(0, _assert.default)(Number.isFinite(resolvedPriority) && resolvedPriority >= 0); | ||
(0, _assert2.default)(Number.isFinite(resolvedPriority) && resolvedPriority >= 0); | ||
return resolvedPriority; | ||
@@ -541,3 +567,3 @@ } | ||
(0, _assert.default)(typeof newOpts.message === 'string' || (0, _typeof2.default)(newOpts.message) === 'object'); | ||
(0, _assert2.default)(typeof newOpts.message === 'string' || (0, _typeof2.default)(newOpts.message) === 'object'); | ||
return Object.assign(newOpts, opts); | ||
@@ -544,0 +570,0 @@ } |
@@ -10,5 +10,5 @@ "use strict"; | ||
if (!condition) { | ||
throw new Error("Assertion failed. ".concat(message)); | ||
throw new Error(message || 'Assertion failed'); | ||
} | ||
} | ||
//# sourceMappingURL=assert.js.map |
@@ -50,3 +50,3 @@ "use strict"; | ||
var VERSION = typeof "2.0.1" !== 'undefined' ? "2.0.1" : 'untranspiled source'; | ||
var VERSION = typeof "2.1.0" !== 'undefined' ? "2.1.0" : 'untranspiled source'; | ||
exports.VERSION = VERSION; | ||
@@ -53,0 +53,0 @@ var isBrowser = (0, _isBrowser.default)(); |
@@ -99,2 +99,6 @@ import { VERSION } from './utils/globals'; | ||
assert(condition, message) { | ||
assert(condition, message); | ||
} | ||
warn(message, ...args) { | ||
@@ -201,2 +205,20 @@ return this._getLogFunction({ | ||
settings() { | ||
if (console.table) { | ||
console.table(this._storage.config); | ||
} else { | ||
console.log(this._storage.config); | ||
} | ||
} | ||
get(setting) { | ||
return this._storage.config[setting]; | ||
} | ||
set(setting, value) { | ||
this._storage.updateConfiguration({ | ||
[setting]: value | ||
}); | ||
} | ||
_logImageInNode({ | ||
@@ -203,0 +225,0 @@ image, |
export default function assert(condition, message) { | ||
if (!condition) { | ||
throw new Error(`Assertion failed. ${message}`); | ||
throw new Error(message || 'Assertion failed'); | ||
} | ||
} | ||
//# sourceMappingURL=assert.js.map |
import checkIfBrowser from '../../env/is-browser'; | ||
export { self, window, global, document, process, console } from '../../env/globals'; | ||
export const VERSION = typeof "2.0.1" !== 'undefined' ? "2.0.1" : 'untranspiled source'; | ||
export const VERSION = typeof "2.1.0" !== 'undefined' ? "2.1.0" : 'untranspiled source'; | ||
export const isBrowser = checkIfBrowser(); | ||
//# sourceMappingURL=globals.js.map |
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
@@ -12,3 +13,3 @@ import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import { isBrowser } from './utils/globals'; | ||
import assert from '../lib/utils/assert'; | ||
import _assert from '../lib/utils/assert'; | ||
var originalConsole = { | ||
@@ -105,2 +106,7 @@ debug: isBrowser ? console.debug || console.log : console.log, | ||
}, { | ||
key: "assert", | ||
value: function assert(condition, message) { | ||
_assert(condition, message); | ||
} | ||
}, { | ||
key: "warn", | ||
@@ -242,2 +248,21 @@ value: function warn(message) { | ||
}, { | ||
key: "settings", | ||
value: function settings() { | ||
if (console.table) { | ||
console.table(this._storage.config); | ||
} else { | ||
console.log(this._storage.config); | ||
} | ||
} | ||
}, { | ||
key: "get", | ||
value: function get(setting) { | ||
return this._storage.config[setting]; | ||
} | ||
}, { | ||
key: "set", | ||
value: function set(setting, value) { | ||
this._storage.updateConfiguration(_defineProperty({}, setting, value)); | ||
} | ||
}, { | ||
key: "_logImageInNode", | ||
@@ -429,3 +454,5 @@ value: function _logImageInNode(_ref3) { | ||
opts = this._parseArguments(opts); | ||
assert(method); | ||
_assert(method); | ||
var _opts3 = opts, | ||
@@ -481,3 +508,4 @@ message = _opts3.message; | ||
assert(Number.isFinite(resolvedPriority) && resolvedPriority >= 0); | ||
_assert(Number.isFinite(resolvedPriority) && resolvedPriority >= 0); | ||
return resolvedPriority; | ||
@@ -522,3 +550,4 @@ } | ||
assert(typeof newOpts.message === 'string' || _typeof(newOpts.message) === 'object'); | ||
_assert(typeof newOpts.message === 'string' || _typeof(newOpts.message) === 'object'); | ||
return Object.assign(newOpts, opts); | ||
@@ -525,0 +554,0 @@ } |
export default function assert(condition, message) { | ||
if (!condition) { | ||
throw new Error("Assertion failed. ".concat(message)); | ||
throw new Error(message || 'Assertion failed'); | ||
} | ||
} | ||
//# sourceMappingURL=assert.js.map |
import checkIfBrowser from '../../env/is-browser'; | ||
export { self, window, global, document, process, console } from '../../env/globals'; | ||
export var VERSION = typeof "2.0.1" !== 'undefined' ? "2.0.1" : 'untranspiled source'; | ||
export var VERSION = typeof "2.1.0" !== 'undefined' ? "2.1.0" : 'untranspiled source'; | ||
export var isBrowser = checkIfBrowser(); | ||
//# sourceMappingURL=globals.js.map |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "javascript", |
@@ -155,2 +155,6 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
assert(condition, message){ | ||
assert(condition, message); | ||
} | ||
// Warn, but only once, no console flooding | ||
@@ -248,2 +252,21 @@ warn(message, ...args) { | ||
// Logs the current settings as a table | ||
settings() { | ||
if(console.table) { | ||
console.table(this._storage.config); | ||
} else { | ||
console.log(this._storage.config); | ||
} | ||
} | ||
// logs the current status of the setting | ||
get(setting) { | ||
return this._storage.config[setting]; | ||
} | ||
// update the status of the setting | ||
set(setting, value) { | ||
this._storage.updateConfiguration({[setting]: value}); | ||
} | ||
// Use the asciify module to log an image under node.js | ||
@@ -250,0 +273,0 @@ _logImageInNode({image, message = '', scale = 1}) { |
export default function assert(condition, message) { | ||
if (!condition) { | ||
throw new Error(`Assertion failed. ${message}`); | ||
throw new Error(message || 'Assertion failed'); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
638096
7798