Comparing version 1.0.2 to 1.0.3
@@ -27,3 +27,3 @@ var Promise = require('bluebird'); | ||
} else if (line.slice(0, 7) === '#EXTINF') { | ||
var result = /^#EXTINF:(\d+),(.*)$/.exec(line); | ||
var result = /^#EXTINF:(-?)(\d+),(.*)$/.exec(line); | ||
if (!result) | ||
@@ -33,4 +33,4 @@ throw new Error('Invalid M3U format'); | ||
buffer.push({ | ||
title: result[2].trim(), | ||
duration: +(result[1].trim()) | ||
title: result[3].trim(), | ||
duration: +(result[1] + result[2].trim()) | ||
}); | ||
@@ -48,2 +48,2 @@ | ||
module.exports.parse = parse; | ||
module.exports.parse = parse; |
{ | ||
"name": "m3u-parser", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple library for hassle-free M3U playlists parsing", | ||
@@ -19,12 +19,12 @@ "main": "m3u.js", | ||
"bugs": "https://github.com/v12/m3u-parser/issues", | ||
"license": "GPLv3", | ||
"license": "ISC", | ||
"dependencies": { | ||
"bluebird": "^2.9.24" | ||
"bluebird": "^3.1.1" | ||
}, | ||
"devDependencies": { | ||
"chai": "^2.3.0", | ||
"chai": "^3.4.1", | ||
"chai-as-promised": "^5.0.0", | ||
"istanbul": "^0.3.14", | ||
"istanbul": "^0.4.1", | ||
"mocha": "^2.2.5" | ||
} | ||
} |
@@ -0,0 +0,0 @@ # M3U Parser |
@@ -13,10 +13,13 @@ 'use strict'; | ||
var files = [fs.readFileSync(__dirname + '/playlists/extended.m3u')]; | ||
var files = ['extended', 'invalid_extended'] | ||
.map(function (filename) { return fs.readFileSync(__dirname + '/playlists/' + filename + '.m3u'); }); | ||
describe('M3U playlist parser', function () { | ||
it('should be rejeceted when invalid data passed', function () { | ||
it('should be rejected when invalid data passed', function () { | ||
return Promise.all([ | ||
m3u.parse().should.eventually.be.rejected, | ||
m3u.parse(123).should.eventually.be.rejected, | ||
m3u.parse('invalid').should.eventually.be.rejected | ||
m3u.parse('invalid').should.eventually.be.rejected, | ||
m3u.parse(files[1]).should.eventually.be.rejected, | ||
m3u.parse('#EXTM3U\n\ninvalid').should.eventually.be.rejected | ||
]); | ||
@@ -31,3 +34,3 @@ }); | ||
data.should.be.an.instanceOf(Array), | ||
data.should.have.length(4), | ||
data.should.have.length(5), | ||
data[0].should.be.an('object'), | ||
@@ -40,4 +43,9 @@ data[0].should.have.all.keys('file', 'title', 'duration'), | ||
}); | ||
}) | ||
}); | ||
it('should parse negative duration properly', function () { | ||
return m3u.parse(files[ 0 ]).should.be.eventually.fulfilled | ||
.and.have.deep.property('[4].duration', -1); | ||
}); | ||
}); | ||
}); | ||
}); |
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
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
15
0
100
77
32563
+ Addedbluebird@3.7.2(transitive)
- Removedbluebird@2.11.0(transitive)
Updatedbluebird@^3.1.1