rsformat 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/format.js +6 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -1
- package/package.json +1 -1
package/lib/format.js
CHANGED
|
@@ -134,8 +134,12 @@ function buildString(strings, params) {
|
|
|
134
134
|
if (string[idx] == ':') {
|
|
135
135
|
idx++;
|
|
136
136
|
}
|
|
137
|
-
else if (string[idx] != ' '
|
|
138
|
-
|
|
137
|
+
else if (string[idx] != ' '
|
|
138
|
+
&& string[idx] != '\t'
|
|
139
|
+
&& string[idx] != '\r'
|
|
140
|
+
&& string[idx] != '\n'
|
|
141
|
+
&& string[idx] !== undefined) {
|
|
142
|
+
throw error(i - 1, idx, `Expected colon (':') or space character (' '/'\\t'/'\\r'/'\\n') at end of formatting specifier (found '${string[idx]}')`);
|
|
139
143
|
}
|
|
140
144
|
// Format parameter according to specifier
|
|
141
145
|
let formatted = formatParam(param, {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RsString } from './format';
|
|
2
|
-
export { print, println, eprint, eprintln } from './print';
|
|
2
|
+
export { print, println, eprint, eprintln, dbg } from './print';
|
|
3
3
|
/**
|
|
4
4
|
* Tag to use Rust-style formatting in a template literal.
|
|
5
5
|
* Returns an extended `String` object.
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rs = exports.eprintln = exports.eprint = exports.println = exports.print = void 0;
|
|
3
|
+
exports.rs = exports.dbg = exports.eprintln = exports.eprint = exports.println = exports.print = void 0;
|
|
4
4
|
const format_1 = require("./format");
|
|
5
5
|
var print_1 = require("./print");
|
|
6
6
|
Object.defineProperty(exports, "print", { enumerable: true, get: function () { return print_1.print; } });
|
|
7
7
|
Object.defineProperty(exports, "println", { enumerable: true, get: function () { return print_1.println; } });
|
|
8
8
|
Object.defineProperty(exports, "eprint", { enumerable: true, get: function () { return print_1.eprint; } });
|
|
9
9
|
Object.defineProperty(exports, "eprintln", { enumerable: true, get: function () { return print_1.eprintln; } });
|
|
10
|
+
Object.defineProperty(exports, "dbg", { enumerable: true, get: function () { return print_1.dbg; } });
|
|
10
11
|
/**
|
|
11
12
|
* Tag to use Rust-style formatting in a template literal.
|
|
12
13
|
* Returns an extended `String` object.
|