babel-messages
Advanced tools
Comparing version 6.8.0 to 6.22.0
@@ -1,2 +0,2 @@ | ||
/*istanbul ignore next*/"use strict"; | ||
"use strict"; | ||
@@ -11,10 +11,8 @@ exports.__esModule = true; | ||
exports.get = get; | ||
/*istanbul ignore next*/exports.parseArgs = parseArgs; | ||
exports.parseArgs = parseArgs; | ||
var /*istanbul ignore next*/_util = require("util"); | ||
var _util = require("util"); | ||
/*istanbul ignore next*/ | ||
var util = _interopRequireWildcard(_util); | ||
/*istanbul ignore next*/ | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -24,8 +22,3 @@ | ||
/** | ||
* Mapping of messages to be used in Babel. | ||
* Messages can include $0-style placeholders. | ||
*/ | ||
var MESSAGES = /*istanbul ignore next*/exports.MESSAGES = { | ||
var MESSAGES = exports.MESSAGES = { | ||
tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence", | ||
@@ -66,10 +59,3 @@ classesIllegalBareSuper: "Illegal use of bare super", | ||
/** | ||
* Get a message with $0 placeholders replaced by arguments. | ||
*/ | ||
/* eslint max-len: 0 */ | ||
function get(key) { | ||
/*istanbul ignore next*/ | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
@@ -80,8 +66,6 @@ args[_key - 1] = arguments[_key]; | ||
var msg = MESSAGES[key]; | ||
if (!msg) throw new ReferenceError( /*istanbul ignore next*/"Unknown message " + /*istanbul ignore next*/(0, _stringify2.default)(key)); | ||
if (!msg) throw new ReferenceError("Unknown message " + (0, _stringify2.default)(key)); | ||
// stringify args | ||
args = parseArgs(args); | ||
// replace $0 placeholders with args | ||
return msg.replace(/\$(\d+)/g, function (str, i) { | ||
@@ -92,6 +76,2 @@ return args[i - 1]; | ||
/** | ||
* Stingify arguments to be used inside messages. | ||
*/ | ||
function parseArgs(args) { | ||
@@ -103,4 +83,3 @@ return args.map(function (val) { | ||
try { | ||
return (/*istanbul ignore next*/(0, _stringify2.default)(val) || val + "" | ||
); | ||
return (0, _stringify2.default)(val) || val + ""; | ||
} catch (e) { | ||
@@ -107,0 +86,0 @@ return util.inspect(val); |
{ | ||
"name": "babel-messages", | ||
"version": "6.8.0", | ||
"version": "6.22.0", | ||
"description": "Collection of debug messages used by Babel.", | ||
@@ -11,4 +11,4 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"dependencies": { | ||
"babel-runtime": "^6.0.0" | ||
"babel-runtime": "^6.22.0" | ||
} | ||
} |
@@ -8,3 +8,3 @@ # babel-messages | ||
```sh | ||
$ npm install babel-messages | ||
npm install --save-dev babel-messages | ||
``` | ||
@@ -11,0 +11,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4791
65
Updatedbabel-runtime@^6.22.0