Skip to content

Commit fcbee39

Browse files
committed
revert types changes
1 parent f18a115 commit fcbee39

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

lib/moparser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Parser.prototype._handleCharset = function (headers) {
135135
* Adds a translation to the translation object
136136
*
137137
* @param {String} msgid Original string
138-
* @param {String} msgstr Translation for the original string
138+
* @params {String} msgstr Translation for the original string
139139
*/
140140
Parser.prototype._addString = function (msgid, msgstr) {
141141
const translation = {};

lib/pocompiler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ import encoding from 'encoding';
33
import { HEADERS, foldLine, compareMsgid, formatCharset, generateHeader } from './shared.js';
44
import contentType from 'content-type';
55

6-
76
/**
87
* Exposes general compiler function. Takes a translation
98
* object as a parameter and returns PO object
109
*
1110
* @param {Object} table Translation object
12-
* @param options
1311
* @return {Buffer} Compiled PO object
1412
*/
1513
export default function (table, options) {
1614
const compiler = new Compiler(table, options);
1715

1816
return compiler.compile();
19-
}
17+
};
2018

2119
/**
2220
* Creates a PO compiler object.

lib/poparser.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import encoding from 'encoding';
2-
import { formatCharset, parseHeader, parseNPluralFromHeadersSafely } from './shared.js';
2+
import { formatCharset, parseNPluralFromHeadersSafely, parseHeader } from './shared.js';
33
import { Transform } from 'readable-stream';
44
import util from 'util';
55

@@ -68,7 +68,7 @@ Parser.prototype.parse = function () {
6868
/**
6969
* Detects charset for PO strings from the header
7070
*
71-
* @param {Buffer} buf headers Header value
71+
* @param {Buffer} headers Header value
7272
*/
7373
Parser.prototype._handleCharset = function (buf = '') {
7474
const str = buf.toString();
@@ -77,8 +77,8 @@ Parser.prototype._handleCharset = function (buf = '') {
7777
let match;
7878

7979
if ((pos = str.search(/^\s*msgid/im)) >= 0) {
80-
pos = pos + str.substring(pos + 5).search(/^\s*(msgid|msgctxt)/im);
81-
headers = str.substring(0, pos >= 0 ? pos + 5 : str.length);
80+
pos = pos + str.substr(pos + 5).search(/^\s*(msgid|msgctxt)/im);
81+
headers = str.substr(0, pos >= 0 ? pos + 5 : str.length);
8282
}
8383

8484
if ((match = headers.match(/[; ]charset\s*=\s*([\w-]+)(?:[\s;]|\\n)*"\s*$/mi))) {
@@ -533,8 +533,6 @@ function PoParserTransform (options, transformOptions) {
533533
Transform.call(this, transformOptions);
534534
this._writableState.objectMode = false;
535535
this._readableState.objectMode = true;
536-
537-
return this;
538536
}
539537
util.inherits(PoParserTransform, Transform);
540538

lib/shared.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// see https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html
2-
32
const PLURAL_FORMS = 'Plural-Forms';
4-
53
export const HEADERS = new Map([
64
['project-id-version', 'Project-Id-Version'],
75
['report-msgid-bugs-to', 'Report-Msgid-Bugs-To'],
@@ -45,7 +43,6 @@ export function parseHeader (str = '') {
4543
* Attempts to safely parse 'nplurals" value from "Plural-Forms" header
4644
*
4745
* @param {Object} [headers = {}] An object with parsed headers
48-
* @param fallback {Number} Fallback value
4946
* @returns {number} Parsed result
5047
*/
5148
export function parseNPluralFromHeadersSafely (headers, fallback = 1) {
@@ -86,7 +83,6 @@ export function generateHeader (header = {}) {
8683
* Normalizes charset name. Converts utf8 to utf-8, WIN1257 to windows-1257 etc.
8784
*
8885
* @param {String} charset Charset name
89-
* @param defaultCharset Default charset (default: 'iso-8859-1')
9086
* @return {String} Normalized charset name
9187
*/
9288
export function formatCharset (charset = 'iso-8859-1', defaultCharset = 'iso-8859-1') {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"prepublish": "tsc && npm run lint && npm run test"
2727
},
2828
"main": "./index.js",
29+
"types": "./index.d.ts",
2930
"license": "MIT",
3031
"dependencies": {
3132
"content-type": "^1.0.5",

0 commit comments

Comments
 (0)