@lrc-maker/lrc-parser
Advanced tools
Comparing version 0.1.10 to 0.1.15
@@ -1,7 +0,1 @@ | ||
declare global { | ||
interface String { | ||
trimStart(): string; | ||
trimEnd(): string; | ||
} | ||
} | ||
export declare type Fixed = 0 | 1 | 2 | 3; | ||
@@ -8,0 +2,0 @@ export interface ILyric { |
@@ -55,3 +55,3 @@ (function (global, factory) { | ||
var _b = option.trimStart, trimStart = _b === void 0 ? false : _b, _c = option.trimEnd, trimEnd = _c === void 0 ? false : _c; | ||
var lines = lrcString.split(/\r\n|\n|\r/); | ||
var lines = lrcString.split(/\r\n|\n|\r/u); | ||
var timeTag = /\[\s*(\d{1,3}):(\d{1,2}(?:[:.]\d{1,3})?)\s*]/g; | ||
@@ -120,12 +120,10 @@ var infoTag = /\[\s*(\w{1,6})\s*:(.*?)]/; | ||
} | ||
else { | ||
var newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
} | ||
var newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
}; | ||
@@ -132,0 +130,0 @@ var convertTimeToTag = function (time, fixed, withBrackets) { |
@@ -1,7 +0,1 @@ | ||
declare global { | ||
interface String { | ||
trimStart(): string; | ||
trimEnd(): string; | ||
} | ||
} | ||
export declare type Fixed = 0 | 1 | 2 | 3; | ||
@@ -8,0 +2,0 @@ export interface ILyric { |
@@ -9,3 +9,3 @@ (function (global, factory) { | ||
const { trimStart = false, trimEnd = false } = option; | ||
const lines = lrcString.split(/\r\n|\n|\r/); | ||
const lines = lrcString.split(/\r\n|\n|\r/u); | ||
const timeTag = /\[\s*(\d{1,3}):(\d{1,2}(?:[:.]\d{1,3})?)\s*]/g; | ||
@@ -64,12 +64,10 @@ const infoTag = /\[\s*(\w{1,6})\s*:(.*?)]/; | ||
} | ||
else { | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
} | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
}; | ||
@@ -76,0 +74,0 @@ const convertTimeToTag = (time, fixed, withBrackets = true) => { |
@@ -1,7 +0,1 @@ | ||
declare global { | ||
interface String { | ||
trimStart(): string; | ||
trimEnd(): string; | ||
} | ||
} | ||
export declare type Fixed = 0 | 1 | 2 | 3; | ||
@@ -8,0 +2,0 @@ export interface ILyric { |
export const parser = (lrcString, option = {}) => { | ||
const { trimStart = false, trimEnd = false } = option; | ||
const lines = lrcString.split(/\r\n|\n|\r/); | ||
const lines = lrcString.split(/\r\n|\n|\r/u); | ||
const timeTag = /\[\s*(\d{1,3}):(\d{1,2}(?:[:.]\d{1,3})?)\s*]/g; | ||
@@ -57,12 +57,10 @@ const infoTag = /\[\s*(\w{1,6})\s*:(.*?)]/; | ||
} | ||
else { | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
} | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
}; | ||
@@ -69,0 +67,0 @@ export const convertTimeToTag = (time, fixed, withBrackets = true) => { |
@@ -1,7 +0,1 @@ | ||
declare global { | ||
interface String { | ||
trimStart(): string; | ||
trimEnd(): string; | ||
} | ||
} | ||
export declare type Fixed = 0 | 1 | 2 | 3; | ||
@@ -8,0 +2,0 @@ export interface ILyric { |
@@ -9,3 +9,3 @@ (function (global, factory) { | ||
const { trimStart = false, trimEnd = false } = option; | ||
const lines = lrcString.split(/\r\n|\n|\r/); | ||
const lines = lrcString.split(/\r\n|\n|\r/u); | ||
const timeTag = /\[\s*(\d{1,3}):(\d{1,2}(?:[:.]\d{1,3})?)\s*]/g; | ||
@@ -64,12 +64,10 @@ const infoTag = /\[\s*(\w{1,6})\s*:(.*?)]/; | ||
} | ||
else { | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
} | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
}; | ||
@@ -76,0 +74,0 @@ const convertTimeToTag = (time, fixed, withBrackets = true) => { |
{ | ||
"name": "@lrc-maker/lrc-parser", | ||
"description": "lrc-parser for lrc-maker", | ||
"version": "0.1.10", | ||
"version": "0.1.15", | ||
"repository": "https://github.com/lrc-maker/lrc-parser.git", | ||
@@ -24,6 +24,6 @@ "author": "magic-akari <hufan.akarin@gmail.com>", | ||
"scripts": { | ||
"build": "npm run esm && npm run rollup", | ||
"build": "pnpm run esm && pnpm run rollup", | ||
"esm": "tsc --outDir build/esm", | ||
"rollup": "rollup -c", | ||
"test": "TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\" }' mocha -r ts-node/register test/**/*.test.ts", | ||
"test": "deno test --allow-read test", | ||
"prettier": "prettier --write src/**/*.ts *.{json,md}", | ||
@@ -34,16 +34,9 @@ "listdiff": "prettier -l src/**/*.ts *.{json,md}", | ||
"devDependencies": { | ||
"@types/chai": "^4.2.13", | ||
"@types/mocha": "^8.0.3", | ||
"@types/node": "^14.11.4", | ||
"@typescript-eslint/eslint-plugin": "^4.4.0", | ||
"@typescript-eslint/parser": "^4.4.0", | ||
"chai": "^4.2.0", | ||
"eslint": "^7.10.0", | ||
"eslint-config-prettier": "^6.12.0", | ||
"mocha": "^8.1.3", | ||
"prettier": "^2.1.2", | ||
"rollup": "^2.28.2", | ||
"rollup-plugin-typescript2": "^0.27.3", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.3" | ||
"eslint": "^7.23.0", | ||
"eslint-config-akari": "^0.0.2", | ||
"prettier": "^2.2.1", | ||
"rollup": "^2.44.0", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"tslib": "^2.2.0", | ||
"typescript": "^4.2.3" | ||
}, | ||
@@ -50,0 +43,0 @@ "publishConfig": { |
@@ -1,8 +0,1 @@ | ||
declare global { | ||
interface String { | ||
trimStart(): string; | ||
trimEnd(): string; | ||
} | ||
} | ||
export type Fixed = 0 | 1 | 2 | 3; | ||
@@ -26,5 +19,6 @@ | ||
export const parser = (lrcString: string, option: TrimOptios = {}): State => { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const { trimStart = false, trimEnd = false } = option; | ||
const lines = lrcString.split(/\r\n|\n|\r/); | ||
const lines = lrcString.split(/\r\n|\n|\r/u); | ||
@@ -34,3 +28,3 @@ const timeTag = /\[\s*(\d{1,3}):(\d{1,2}(?:[:.]\d{1,3})?)\s*]/g; | ||
const info: Map<string, string> = new Map(); | ||
const info = new Map<string, string>(); | ||
const lyric: ILyric[] = []; | ||
@@ -103,12 +97,11 @@ | ||
return storedFormatter.get(fixed)!; | ||
} else { | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
} | ||
const newFormatter = new Intl.NumberFormat("en", { | ||
minimumIntegerDigits: 2, | ||
minimumFractionDigits: fixed, | ||
maximumFractionDigits: fixed, | ||
useGrouping: false, | ||
}); | ||
storedFormatter.set(fixed, newFormatter); | ||
return newFormatter; | ||
}; | ||
@@ -115,0 +108,0 @@ |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
7
60545
705
2