{"_id":"@aryareal/lrc-js","_rev":"5-aea885219c660624f794abc259da97ed","name":"@aryareal/lrc-js","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.2":{"name":"@aryareal/lrc-js","version":"1.0.2","keywords":["lrc","lyric","parser","typescript"],"author":{"name":"AryaReal"},"license":"MIT","_id":"@aryareal/lrc-js@1.0.2","maintainers":[{"name":"aryareal","email":"aryadwiputra193@gmail.com"}],"dist":{"shasum":"d4ca06d25e407b1d5f91f3321b1513b3a5bb4a5f","tarball":"https://registry.npmjs.org/@aryareal/lrc-js/-/lrc-js-1.0.2.tgz","fileCount":6,"integrity":"sha512-qX/44Cx6tjdNWEKYGdpGTfr03D0bO9fnrN/cH5dRtCVw4b95t4KxSF/QtZUqj8Bkub8fzXRSVguHQwZv5+9TWw==","signatures":[{"sig":"MEQCIAzoCl3YDpVefTV6AfG9bubiXIXhPu+t6sk9ZDesIFMCAiBsyKw6FPp6NGK6RPCViGoMzgTsavCfD7KP2ZFXCY/CCw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30412},"main":"dist/index.cjs.js","types":"dist/index.d.ts","module":"dist/index.esm.js","gitHead":"d93d2fd1141c8acebfbdb6ba0d36398999e20d30","scripts":{"test":"jest","build":"rm -rf dist && rollup -c","test:local":"node node_modules/jest/bin/jest.js"},"_npmUser":{"name":"aryareal","email":"aryadwiputra193@gmail.com"},"_npmVersion":"10.8.2","description":"Parse LRC to javascript object","directories":{},"_nodeVersion":"20.18.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.8.1","rollup":"^4.29.1","typescript":"^5.7.2","@types/jest":"^29.5.14","@types/node":"^22.10.2","@babel/preset-env":"^7.26.0","rollup-plugin-dts":"^6.1.1","@babel/preset-typescript":"^7.26.0","@rollup/plugin-typescript":"^12.1.2"},"_npmOperationalInternal":{"tmp":"tmp/lrc-js_1.0.2_1735827353924_0.6390883577791544","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@aryareal/lrc-js","version":"1.0.3","keywords":["lrc","lyric","parser","typescript"],"author":{"name":"AryaReal"},"license":"MIT","_id":"@aryareal/lrc-js@1.0.3","maintainers":[{"name":"aryareal","email":"aryadwiputra193@gmail.com"}],"dist":{"shasum":"2fad2e4e27c97bec150fcb40ac45e8c1b46b4e16","tarball":"https://registry.npmjs.org/@aryareal/lrc-js/-/lrc-js-1.0.3.tgz","fileCount":6,"integrity":"sha512-gBnLkmvojDprqUpXnn/xuE0c9ZXv/aYSYPMUXrYaCGj/QHkIGg3J9w7T0gAn2+6B3MkDWIV9WB08T4ELF0pzVg==","signatures":[{"sig":"MEQCICj/gwfqqp8hLYvYn7v8dX7VLUYhhaqRMTVUjZEZYUSiAiBcRR+I3/gWKnWG6W0XCW7Kx9lMItGToXm/Mj1BvQNTJQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30407},"main":"dist/index.cjs.js","types":"dist/index.d.ts","module":"dist/index.esm.js","gitHead":"1d265e04904a8d4e1bc336eed24dd2b6239517d7","scripts":{"test":"jest","build":"rm -rf dist && rollup -c","test:local":"node node_modules/jest/bin/jest.js"},"_npmUser":{"name":"aryareal","email":"aryadwiputra193@gmail.com"},"_npmVersion":"10.8.2","description":"Parse LRC to javascript object","directories":{},"_nodeVersion":"20.18.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.8.1","rollup":"^4.29.1","typescript":"^5.7.2","@types/jest":"^29.5.14","@types/node":"^22.10.2","@babel/preset-env":"^7.26.0","rollup-plugin-dts":"^6.1.1","@babel/preset-typescript":"^7.26.0","@rollup/plugin-typescript":"^12.1.2"},"_npmOperationalInternal":{"tmp":"tmp/lrc-js_1.0.3_1735830541288_0.7722886483246343","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@aryareal/lrc-js","version":"1.0.4","description":"Parse LRC to javascript object","main":"dist/index.cjs.js","module":"dist/index.esm.js","types":"dist/index.d.ts","scripts":{"test":"jest","test:local":"node node_modules/jest/bin/jest.js","build":"rm -rf dist && rollup -c"},"keywords":["lrc","lyric","parser","typescript"],"author":{"name":"AryaReal"},"repository":{"type":"git","url":"git+https://github.com/aryareal1/lrc-js.git"},"bugs":{"url":"https://github.com/aryareal1/lrc-js/issue"},"homepage":"https://github.com/aryareal1/lrc-js","license":"MIT","devDependencies":{"@babel/preset-env":"^7.26.0","@babel/preset-typescript":"^7.26.0","@rollup/plugin-typescript":"^12.1.2","@types/jest":"^29.5.14","@types/node":"^22.10.2","jest":"^29.7.0","rollup":"^4.29.1","rollup-plugin-dts":"^6.1.1","tslib":"^2.8.1","typescript":"^5.7.2"},"_id":"@aryareal/lrc-js@1.0.4","gitHead":"b7649efc92e3f8b0687e87b7b38acec7bfc059f3","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-m2cbmz/Z9QV+K5HVitYqtSzMVv8L8peFTiUuuPNDmLkW0InNvaaUFlEuAVu+cG49JuG/auApOaLFN9ofU23y+A==","shasum":"b9919ceae6fbd31efb7d7890f015096536e67b72","tarball":"https://registry.npmjs.org/@aryareal/lrc-js/-/lrc-js-1.0.4.tgz","fileCount":6,"unpackedSize":30641,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD9ZBVVN5ktoptjJySOEb7Y0i9ijbYEvJVCWYPMkWREVAIhAP9p37aizqd2evuCHC5J768oIJwxR4i54yeBHo0/1Q7m"}]},"_npmUser":{"name":"aryareal","email":"aryadwiputra193@gmail.com"},"directories":{},"maintainers":[{"name":"aryareal","email":"aryadwiputra193@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lrc-js_1.0.4_1735830902926_0.27595418765002977"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-02T14:15:53.811Z","modified":"2025-01-02T15:15:03.304Z","1.0.0":"2025-01-02T14:11:10.467Z","1.0.2":"2025-01-02T14:15:54.097Z","1.0.3":"2025-01-02T15:09:01.550Z","1.0.4":"2025-01-02T15:15:03.116Z"},"author":{"name":"AryaReal"},"license":"MIT","keywords":["lrc","lyric","parser","typescript"],"description":"Parse LRC to javascript object","maintainers":[{"name":"aryareal","email":"aryadwiputra193@gmail.com"}],"readme":"# LRC-JS\n\nParse LRC into javascript object.\n\n## Features\n\n- Typescript support\n- Browser and Node.js support\n- Default and enchanced LRC format support\n- Simple usage yet powerfull\n\n## Installation & Usage\n\nType this to install:\n\n```sh\nnpm install @aryareal/lrc-js\n```\n\nHere is the example usage:\n\n```js\nimport { parseLrc } from \"@aryareal/lrc-js\";\n\nlet lyric = `[ti: Song Title]\n[ar: The Best Artist]\nPlain text goes bluah\n\n[00:00.92][01:24.92][02:23.21]Lyric line with many timestamp\n[00:02.86]Just a normal lyric line\n[00:04.55][interlude]\n[00:05.23]First multiline lyric\n[00:05.23]Second multiline lyric\n[00:05.23]Third multiline lyric\n[01:28.00] <01:28.78> Enhanced <01:29.45> lyric <01:31.22> word <01:35.29> by word`;\n\nconsole.log(parseLrc(lyric));\n```\n\nThe output will be:\n\n```json\n[\n  {\n    \"line\": 0,\n    \"type\": \"metadata\",\n    \"key\": \"ti\",\n    \"value\": \" Song Title\",\n    \"raw\": \"[ti: Song Title]\"\n  },\n  {\n    \"line\": 1,\n    \"type\": \"metadata\",\n    \"key\": \"ar\",\n    \"value\": \" The Best Artist\",\n    \"raw\": \"[ar: The Best Artist]\"\n  },\n  {\n    \"line\": 2,\n    \"type\": \"plain\",\n    \"raw\": \"Plain text goes bluah\"\n  },\n  {\n    \"line\": 3,\n    \"type\": \"plain\",\n    \"raw\": \"\"\n  },\n  {\n    \"line\": 4,\n    \"type\": \"lyric\",\n    \"timestamp\": 920,\n    \"content\": \"Lyric line with many timestamp\",\n    \"raw\": \"[00:00.92][01:24.92][02:23.21]Lyric line with many timestamp\"\n  },\n  {\n    \"line\": 4,\n    \"type\": \"lyric\",\n    \"timestamp\": 84920,\n    \"content\": \"Lyric line with many timestamp\",\n    \"raw\": \"[00:00.92][01:24.92][02:23.21]Lyric line with many timestamp\"\n  },\n  {\n    \"line\": 4,\n    \"type\": \"lyric\",\n    \"timestamp\": 143210,\n    \"content\": \"Lyric line with many timestamp\",\n    \"raw\": \"[00:00.92][01:24.92][02:23.21]Lyric line with many timestamp\"\n  },\n  {\n    \"line\": 5,\n    \"type\": \"lyric\",\n    \"timestamp\": 2860,\n    \"content\": \"Just a normal lyric line\",\n    \"raw\": \"[00:02.86]Just a normal lyric line\"\n  },\n  {\n    \"line\": 6,\n    \"type\": \"instrument\",\n    \"timestamp\": 4550,\n    \"part\": \"interlude\",\n    \"raw\": \"[00:04.55][interlude]\"\n  },\n  {\n    \"type\": \"multi_lyric\",\n    \"timestamp\": 5230,\n    \"lines\": [\n      {\n        \"line\": 7,\n        \"content\": \"First multiline lyric\",\n        \"raw\": \"[00:05.23]First multiline lyric\"\n      },\n      {\n        \"line\": 8,\n        \"content\": \"Second multiline lyric\",\n        \"raw\": \"[00:05.23]Second multiline lyric\"\n      },\n      {\n        \"line\": 9,\n        \"content\": \"Third multiline lyric\",\n        \"raw\": \"[00:05.23]Third multiline lyric\"\n      }\n    ],\n    \"content\": \"First multiline lyric\\nSecond multiline lyric\\nThird multiline lyric\"\n  },\n  {\n    \"line\": 10,\n    \"type\": \"enhanced_lyric\",\n    \"timestamp\": 88000,\n    \"words\": [\n      {\n        \"index\": 0,\n        \"timestamp\": 88780,\n        \"content\": \" Enhanced \",\n        \"raw\": \"<01:28.78> Enhanced \"\n      },\n      {\n        \"index\": 1,\n        \"timestamp\": 89450,\n        \"content\": \" lyric \",\n        \"raw\": \"<01:29.45> lyric \"\n      },\n      {\n        \"index\": 2,\n        \"timestamp\": 91220,\n        \"content\": \" word \",\n        \"raw\": \"<01:31.22> word \"\n      },\n      {\n        \"index\": 3,\n        \"timestamp\": 95290,\n        \"content\": \" by word\",\n        \"raw\": \"<01:35.29> by word\"\n      }\n    ],\n    \"raw\": \"[01:28.00] <01:28.78> Enhanced <01:29.45> lyric <01:31.22> word <01:35.29> by word\"\n  }\n]\n```\n\n## Types of Line\n\n### Plain Line\n\nLine with just plain text\n\n```\nJust a basic line with text\n```\n\n<details>\n  <summary>Output</summary>\n  \n  ```json\n  [\n    {\n      \"line\": 0,\n      \"type\": \"plain\",\n      \"raw\": \"Just a basic line with text\"\n    }\n  ]\n  ```\n</details>\n\n### Metadata Line\n\nLine with tag or metadata format\n\n```\n[ti:Song Title]\n[ar: Song Artist]\n```\n\n<details>\n  <summary>Ouput</summary>\n  \n  ```json\n  [\n    {\n      \"line\": 0,\n      \"type\": \"metadata\",\n      \"key\": \"ti\",\n      \"value\": \"Song Title\",\n      \"raw\": \"[ti:Song Title]\"\n    },\n    {\n      \"line\": 1,\n      \"type\": \"metadata\",\n      \"key\": \"ar\",\n      \"value\": \" Song Artist\",\n      \"raw\": \"[ar: Song Artist]\"\n    }\n  ]\n  ```\n</details>\n\n### Lyric Line\n\nDefault lyric line with timestamp\n\n```\n[00:01.89]Simple lyric line\n```\n\n<details>\n  <summary>Output</summary>\n   \n  ```json\n  [\n    {\n      \"line\": 0,\n      \"type\": \"lyric\",\n      \"timestamp\": 1890,\n      \"content\": \"Simple lyric line\",\n      \"raw\": \"[00:01.89]Simple lyric line\"\n    }\n  ]\n  ```\n</details>\n\n### Repeated Lyric Line\n\nLyric line with multiple timestamps to make repeated lyric.\n\n> [!IMPORTANT]\n> This type is not used by default, `config.repeatedLyric` must be `true` to use this.\n> See output below.\n\n```\n[00:02.83][01:27.23]Lyric line with multiple timestamp\n```\n\n<details>\n  <summary>Output</summary>\n  \n  If `config.repeatedLyric` is `true`:\n  ```json\n  [\n    {\n      \"line\": 0,\n      \"type\": \"repeated_lyric\",\n      \"timestamps\": [ 2830, 87230 ],\n      \"content\": \"Lyric line with multiple timestamp\",\n      \"raw\": \"[00:02.83][01:27.23]Lyric line with multiple timestamp\"\n    }\n  ]\n  ```\n  Otherwise:\n  ```json\n  [\n    {\n      \"line\": 0,\n      \"type\": \"lyric\",\n      \"timestamp\": 2830,\n      \"content\": \"Lyric line with multiple timestamp\",\n      \"raw\": \"[00:02.83][01:27.23]Lyric line with multiple timestamp\"\n    },\n    {\n      \"line\": 0,\n      \"type\": \"lyric\",\n      \"timestamp\": 87230,\n      \"content\": \"Lyric line with multiple timestamp\",\n      \"raw\": \"[00:02.83][01:27.23]Lyric line with multiple timestamp\"\n    }\n  ]\n  ```\n</details>\n\n### Multi Lyric Line\n\nMerges multiple lyric lines with same timestamps into one index in the array.\n\n> [!NOTE]\n> You can turn this off by setting `config.multiLyric` to `false` and it'll return default LyricLine\n\n```\n[01:26.34]First line\n[01:26.34]Second line\n[01:26.34]Third line\n```\n\n<details>\n  <summary>Output</summary>\n\n```json\n[\n  {\n    \"type\": \"multi_lyric\",\n    \"timestamp\": 86340,\n    \"lines\": [\n      {\n        \"line\": 0,\n        \"content\": \"First line\",\n        \"raw\": \"[01:26.34]First line\"\n      },\n      {\n        \"line\": 1,\n        \"content\": \"Second line\",\n        \"raw\": \"[01:26.34]Second line\"\n      },\n      {\n        \"line\": 2,\n        \"content\": \"Third line\",\n        \"raw\": \"[01:26.34]Third line\"\n      }\n    ],\n    \"content\": \"First line\\nSecond line\\nThird line\"\n  }\n]\n```\n\n</details>\n\n### Enhanced Lyric Line\n\nLyric line that support per word sync.\n\n> [!NOTE]\n> You can turn this off by setting `config.enhancedLyric` to `false` and it'll return default LyricLine\n\n```\n[02:34.829] <02:35> Word <02:35.98> by <02:37.12> word\n```\n\n<details>\n  <summary>Output</summary>\n\n```json\n[\n  {\n    \"line\": 0,\n    \"type\": \"enhanced_lyric\",\n    \"timestamp\": 154829,\n    \"words\": [\n      {\n        \"index\": 0,\n        \"timestamp\": 155000,\n        \"content\": \" Word \",\n        \"raw\": \"<02:35> Word \"\n      },\n      {\n        \"index\": 1,\n        \"timestamp\": 155980,\n        \"content\": \" by \",\n        \"raw\": \"<02:35.98> by \"\n      },\n      {\n        \"index\": 2,\n        \"timestamp\": 157120,\n        \"content\": \" word\",\n        \"raw\": \"<02:37.12> word\"\n      }\n    ],\n    \"raw\": \"[02:34.829] <02:35> Word <02:35.98> by <02:37.12> word\"\n  }\n]\n```\n\n</details>\n\n### Instrument Line\n\nLine with timestamp but no lyric, like interlude in a music\n\n```\n[00:00.00][intro]\n[02:43.23]\n[03:32.82][interlude]\n[04:22.34][outro]\n```\n\n<details>\n  <summary>Output</summary>\n\n```json\n[\n  {\n    \"line\": 0,\n    \"type\": \"instrument\",\n    \"timestamp\": 0,\n    \"part\": \"intro\",\n    \"raw\": \"[00:00.00][intro]\"\n  },\n  {\n    \"line\": 1,\n    \"type\": \"instrument\",\n    \"timestamp\": 163230,\n    \"part\": \"interlude\",\n    \"raw\": \"[02:43.23]\"\n  },\n  {\n    \"line\": 2,\n    \"type\": \"instrument\",\n    \"timestamp\": 212820,\n    \"part\": \"interlude\",\n    \"raw\": \"[03:32.82][interlude]\"\n  },\n  {\n    \"line\": 3,\n    \"type\": \"instrument\",\n    \"timestamp\": 262340,\n    \"part\": \"outro\",\n    \"raw\": \"[04:22.34][outro]\"\n  }\n]\n```\n\n</details>\n\n## Reference\n\n### Ⓕ parseLrc(lrc: string, config: IConfig)\n\nMain function to parse LRC content\n\n### Ⓔ LineType\n\nTypes of line: [^](#types-of-line)\n\n- `LineType.Plain` just a plain text line.\n- `LineType.Tag` metadata tag line.\n- `LineType.Lyric` simple lyric line.\n- `LineType.RepeatedLyric` lyric line with multiple timestamps, <ins>not used</ins> by default.\n- `LineType.MultiLyric` merge of lines with same timestamp.\n- `LineType.EnhancedLyric` enhanced lyric line or lyric that sync per word.\n- `LineType.Instrument` line with timestamp but no lyric\n\n### Ⓘ IConfig\n\nParser configuration\n\n- `IConfig.enhancedLyric: boolean` enable parse for enhanced format (default: `true`)\n- `IConfig.multiLyric: boolean` merge lines with same timestamp into one index (default: `true`)\n- `IConfig.repeatedLyric: boolean` make line with multiple timestamp into one index instead of multiple index (default: `false`)\n","readmeFilename":"README.md","homepage":"https://github.com/aryareal1/lrc-js","repository":{"type":"git","url":"git+https://github.com/aryareal1/lrc-js.git"},"bugs":{"url":"https://github.com/aryareal1/lrc-js/issue"}}