Skip to content

Commit

Permalink
Fix stuff for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisMBarr committed Jun 3, 2023
1 parent 6044dc1 commit 9e3f7bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,30 @@ npm install songshowplus-parser --save
```

## Usage
Simply import and create a new instance of `SongShowPlus`, then pass the contents of a SSP7 file as a string to the `.parse()` method.

TypeScript projects
### For TypeScript projects
```
import {readFile} from 'fs';
import { SongShowPlus } from 'songshowplus-parser';
const sspParser = new SongShowPlus();
readFile('Be Near.sbsong', (contents) => {
const song = sspParser.parse(contents);
const song = sspParser.parse(contents.toString());
console.log(song);
});
```

JavaScript projects
### For JavaScript projects
```
const fs = require('fs');
const { SongShowPlus } = require('songshowplus-parser');
const sspParser = new SongShowPlus();
fs.readFile('Be Near.sbsong', (contents) => {
const song = sspParser.parse(contents);
const song = sspParser.parse(contents.toString());
console.log(song);
});
```
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"dist/module",
"!**/*.spec.*",
"!**/*.json",
"!**/*.tsbuildinfo*",
"LICENSE",
"README.md"
],
Expand Down
12 changes: 6 additions & 6 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('SongShowPlus', (): void => {
});

it('should return a song for an ENGLISH SongShow Plus 7 file: "Be Near.sbsong"', () => {
const testFile = readFileSync('./sample-files/Be Near.sbsong');
const testFile = readFileSync('./sample-files/Be Near.sbsong').toString();

expect(sspParser.parse(testFile)).toEqual({
title: 'Be Near',
Expand Down Expand Up @@ -56,7 +56,7 @@ describe('SongShowPlus', (): void => {
});

it('should return a song for an ENGLISH SongShow Plus 7 file: "Give Us Clean Hands.sbsong"', () => {
const testFile = readFileSync('./sample-files/Give Us Clean Hands.sbsong');
const testFile = readFileSync('./sample-files/Give Us Clean Hands.sbsong').toString();

expect(sspParser.parse(testFile)).toEqual({
title: 'Give Us Clean Hands',
Expand Down Expand Up @@ -85,7 +85,7 @@ describe('SongShowPlus', (): void => {
});

it('should return a song for an ENGLISH SongShow Plus 7 file: "Jesus Saves.sbsong"', () => {
const testFile = readFileSync('./sample-files/Jesus Saves.sbsong');
const testFile = readFileSync('./sample-files/Jesus Saves.sbsong').toString();

expect(sspParser.parse(testFile)).toEqual({
title: 'Jesus Saves (2)',
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('SongShowPlus', (): void => {
});

it('should return a song for an ENGLISH SongShow Plus 7 file: "You Are.sbsong"', () => {
const testFile = readFileSync('./sample-files/You Are.sbsong');
const testFile = readFileSync('./sample-files/You Are.sbsong').toString();

expect(sspParser.parse(testFile)).toEqual({
title: 'You Are (2)',
Expand Down Expand Up @@ -172,7 +172,7 @@ describe('SongShowPlus', (): void => {
});

it('should return a song for a SPANISH SongShow Plus 7 file: "Devuelveme El Gozo.sbsong"', () => {
const testFile = readFileSync('./sample-files/Devuelveme El Gozo.sbsong');
const testFile = readFileSync('./sample-files/Devuelveme El Gozo.sbsong').toString();

expect(sspParser.parse(testFile)).toEqual({
title: 'Devuelveme El Gozo',
Expand All @@ -196,7 +196,7 @@ describe('SongShowPlus', (): void => {
});

it('should return a song for a SPANISH SongShow Plus 7 file: "La Sangre (The Blood).sbsong"', () => {
const testFile = readFileSync('./sample-files/La Sangre (The Blood).sbsong');
const testFile = readFileSync('./sample-files/La Sangre (The Blood).sbsong').toString();

expect(sspParser.parse(testFile)).toEqual({
title: 'La Sangre (The Blood)',
Expand Down
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ export class SongShowPlus {

private readonly textCleaner = new TextCleaner();

parse(fileContent: string | Buffer): ISongShowPlusSong {
if (fileContent instanceof Buffer) {
fileContent = fileContent.toString();
}

parse(fileContent: string): ISongShowPlusSong {
let title = '';
let artist = '';
let copyright = '';
Expand Down
File renamed without changes.

0 comments on commit 9e3f7bc

Please sign in to comment.