pgn-parser
Advanced tools
+7
| Copyright 2020 Kevin Ludwig | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
+2
-1
| { | ||
| "name": "pgn-parser", | ||
| "version": "1.0.2", | ||
| "version": "2.0.0", | ||
| "description": "pgn parser", | ||
@@ -20,2 +20,3 @@ "keywords": [ | ||
| "scripts": { | ||
| "pretest": "npm run dist", | ||
| "test": "mocha", | ||
@@ -22,0 +23,0 @@ "dist": "webpack -p" |
+5
-5
@@ -28,6 +28,6 @@ ### pgn-parser | ||
| { | ||
| headers: { | ||
| White: "me", | ||
| Black: "you" | ||
| }, | ||
| headers: [ | ||
| {name: "White", value: "me"}, | ||
| {name: "Black", value: "you"} | ||
| ], | ||
| result: "*", | ||
@@ -40,3 +40,3 @@ moves: [ | ||
| { move: 'Bc4', move_number: 3}, | ||
| { move: 'Bc5', ravs: [{ moves: [{move_number: 3, move: "...Nf6", comment: "is the two knights"}]}]}, | ||
| { move: 'Bc5', ravs: [{ moves: [{move_number: 3, move: "...Nf6", comments: [{text: "is the two knights"}]}]}]}, | ||
| { move: 'b4', move_number: 4}, | ||
@@ -43,0 +43,0 @@ { move: 'Bxb4'}, |
+17
-1
@@ -140,4 +140,20 @@ const chai = require('chai'), | ||
| results.should.have.lengthOf(1); | ||
| results[0].comment_above_header.should.have.lengthOf(1); | ||
| results[0].comments_above_header.should.have.lengthOf(1); | ||
| results[0].comments_above_header[0].text.should.be.eql(' lead comment'); | ||
| }); | ||
| it('should support multiple comments between half-moves', () => { | ||
| const results = parser.parse('1. e4 { this is a comment } { [%csl Gd5,Gf5][%cal Ge4d5,Ge4f5] } *'); | ||
| results[0].moves.should.have.lengthOf(1); | ||
| }); | ||
| it('should fully parse command commments', () => { | ||
| const results = parser.parse('1. e4 { this is a comment } { [%csl Gd5,Gf5][%cal Ge4d5,Ge4f5] } *'); | ||
| results[0].moves.should.have.lengthOf(1); | ||
| results[0].moves[0].comments.should.have.lengthOf(2); | ||
| results[0].moves[0].comments[0].text.should.be.eql(' this is a comment '); | ||
| results[0].moves[0].comments[1].commands.should.have.lengthOf(2); | ||
| results[0].moves[0].comments[1].commands[0].key.should.be.eql('csl'); | ||
| results[0].moves[0].comments[1].commands[0].values.should.be.eql(['Gd5', 'Gf5']); | ||
| }); | ||
| }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
503511
0.71%11
10%585
2.81%