New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lrc-maker/lrc-parser

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrc-maker/lrc-parser - npm Package Compare versions

Comparing version 0.1.15 to 0.1.17

6

build/es5/lrc-parser.d.ts

@@ -1,2 +0,2 @@

export declare type Fixed = 0 | 1 | 2 | 3;
export type Fixed = 0 | 1 | 2 | 3;
export interface ILyric {

@@ -6,7 +6,7 @@ time?: number;

}
export declare type State = Readonly<{
export type State = Readonly<{
info: Map<string, string>;
lyric: readonly ILyric[];
}>;
export declare type TrimOptios = Partial<{
export type TrimOptios = Partial<{
trimStart: boolean;

@@ -13,0 +13,0 @@ trimEnd: boolean;

@@ -5,5 +5,5 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lrcParser = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';
/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

@@ -103,12 +103,17 @@

}
if (trimStart || trimEnd) {
if (trimStart && trimEnd) {
lyric.forEach(function (line) {
if (trimStart) {
line.text = line.text.trimStart();
}
if (trimEnd) {
line.text = line.text.trimEnd();
}
line.text = line.text.trim();
});
}
else if (trimStart) {
lyric.forEach(function (line) {
line.text = line.text.trimStart();
});
}
else if (trimEnd) {
lyric.forEach(function (line) {
line.text = line.text.trimEnd();
});
}
return { info: info, lyric: lyric };

@@ -140,3 +145,3 @@ };

var ss = formatter.format(time % 60);
return withBrackets ? "[" + mm + ":" + ss + "]" : mm + ":" + ss;
return withBrackets ? "[".concat(mm, ":").concat(ss, "]") : "".concat(mm, ":").concat(ss);
};

@@ -157,3 +162,3 @@ var formatText = function (text, spaceStart, spaceEnd) {

var _b = __read(_a, 2), name = _b[0], value = _b[1];
return "[" + name + ": " + value + "]";
return "[".concat(name, ": ").concat(value, "]");
});

@@ -165,3 +170,3 @@ var lines = state.lyric.map(function (line) {

var text = formatText(line.text, spaceStart, spaceEnd);
return "" + convertTimeToTag(line.time, fixed) + text;
return "".concat(convertTimeToTag(line.time, fixed)).concat(text);
});

@@ -176,5 +181,3 @@ return infos.concat(lines).join(endOfLine);

Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
//# sourceMappingURL=lrc-parser.js.map

@@ -1,2 +0,2 @@

export declare type Fixed = 0 | 1 | 2 | 3;
export type Fixed = 0 | 1 | 2 | 3;
export interface ILyric {

@@ -6,7 +6,7 @@ time?: number;

}
export declare type State = Readonly<{
export type State = Readonly<{
info: Map<string, string>;
lyric: readonly ILyric[];
}>;
export declare type TrimOptios = Partial<{
export type TrimOptios = Partial<{
trimStart: boolean;

@@ -13,0 +13,0 @@ trimEnd: boolean;

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lrcParser = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';

@@ -47,12 +47,17 @@ const parser = (lrcString, option = {}) => {

}
if (trimStart || trimEnd) {
if (trimStart && trimEnd) {
lyric.forEach((line) => {
if (trimStart) {
line.text = line.text.trimStart();
}
if (trimEnd) {
line.text = line.text.trimEnd();
}
line.text = line.text.trim();
});
}
else if (trimStart) {
lyric.forEach((line) => {
line.text = line.text.trimStart();
});
}
else if (trimEnd) {
lyric.forEach((line) => {
line.text = line.text.trimEnd();
});
}
return { info, lyric };

@@ -115,5 +120,3 @@ };

Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
//# sourceMappingURL=lrc-parser.js.map

@@ -1,2 +0,2 @@

export declare type Fixed = 0 | 1 | 2 | 3;
export type Fixed = 0 | 1 | 2 | 3;
export interface ILyric {

@@ -6,7 +6,7 @@ time?: number;

}
export declare type State = Readonly<{
export type State = Readonly<{
info: Map<string, string>;
lyric: readonly ILyric[];
}>;
export declare type TrimOptios = Partial<{
export type TrimOptios = Partial<{
trimStart: boolean;

@@ -13,0 +13,0 @@ trimEnd: boolean;

@@ -40,12 +40,17 @@ export const parser = (lrcString, option = {}) => {

}
if (trimStart || trimEnd) {
if (trimStart && trimEnd) {
lyric.forEach((line) => {
if (trimStart) {
line.text = line.text.trimStart();
}
if (trimEnd) {
line.text = line.text.trimEnd();
}
line.text = line.text.trim();
});
}
else if (trimStart) {
lyric.forEach((line) => {
line.text = line.text.trimStart();
});
}
else if (trimEnd) {
lyric.forEach((line) => {
line.text = line.text.trimEnd();
});
}
return { info, lyric };

@@ -52,0 +57,0 @@ };

@@ -1,2 +0,2 @@

export declare type Fixed = 0 | 1 | 2 | 3;
export type Fixed = 0 | 1 | 2 | 3;
export interface ILyric {

@@ -6,7 +6,7 @@ time?: number;

}
export declare type State = Readonly<{
export type State = Readonly<{
info: Map<string, string>;
lyric: readonly ILyric[];
}>;
export declare type TrimOptios = Partial<{
export type TrimOptios = Partial<{
trimStart: boolean;

@@ -13,0 +13,0 @@ trimEnd: boolean;

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lrcParser = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';

@@ -47,12 +47,17 @@ const parser = (lrcString, option = {}) => {

}
if (trimStart || trimEnd) {
if (trimStart && trimEnd) {
lyric.forEach((line) => {
if (trimStart) {
line.text = line.text.trimStart();
}
if (trimEnd) {
line.text = line.text.trimEnd();
}
line.text = line.text.trim();
});
}
else if (trimStart) {
lyric.forEach((line) => {
line.text = line.text.trimStart();
});
}
else if (trimEnd) {
lyric.forEach((line) => {
line.text = line.text.trimEnd();
});
}
return { info, lyric };

@@ -115,5 +120,3 @@ };

Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
//# sourceMappingURL=lrc-parser.js.map
{
"name": "@lrc-maker/lrc-parser",
"description": "lrc-parser for lrc-maker",
"version": "0.1.15",
"version": "0.1.17",
"repository": "https://github.com/lrc-maker/lrc-parser.git",

@@ -23,2 +23,4 @@ "author": "magic-akari <hufan.akarin@gmail.com>",

],
"type": "module",
"packageManager": "pnpm@7.26.0",
"scripts": {

@@ -29,14 +31,17 @@ "build": "pnpm run esm && pnpm run rollup",

"test": "deno test --allow-read test",
"prettier": "prettier --write src/**/*.ts *.{json,md}",
"listdiff": "prettier -l src/**/*.ts *.{json,md}",
"fmt": "dprint fmt",
"listdiff": "dprint check",
"lint": "eslint \"src/**/*.ts\""
},
"devDependencies": {
"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"
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"dprint": "^0.34.4",
"eslint": "^8.32.0",
"eslint-config-akari": "^0.0.6",
"eslint-config-prettier": "^8.6.0",
"rollup": "^3.10.1",
"rollup-plugin-typescript2": "^0.34.1",
"tslib": "^2.4.1",
"typescript": "^4.9.4"
},

@@ -43,0 +48,0 @@ "publishConfig": {

@@ -19,3 +19,2 @@ export type Fixed = 0 | 1 | 2 | 3;

export const parser = (lrcString: string, option: TrimOptios = {}): State => {
// eslint-disable-next-line @typescript-eslint/naming-convention
const { trimStart = false, trimEnd = false } = option;

@@ -32,2 +31,3 @@

for (const line of lines) {
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
if (line[0] !== "[") {

@@ -77,11 +77,14 @@ lyric.push({

if (trimStart || trimEnd) {
if (trimStart && trimEnd) {
lyric.forEach((line) => {
if (trimStart) {
line.text = line.text.trimStart();
}
if (trimEnd) {
line.text = line.text.trimEnd();
}
line.text = line.text.trim();
});
} else if (trimStart) {
lyric.forEach((line) => {
line.text = line.text.trimStart();
});
} else if (trimEnd) {
lyric.forEach((line) => {
line.text = line.text.trimEnd();
});
}

@@ -88,0 +91,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc