Browse files

Fixed bug with some for loops

  • Loading branch information...
1 parent 3ef919e commit 4591c26c7bc4d9167005abbcc8bf79c1c1135063 @leetreveil committed Apr 9, 2011
Showing with 6 additions and 9 deletions.
  1. +1 −1 lib/id3v2_frames.js
  2. +2 −5 lib/index.js
  3. +1 −1 lib/vorbis.js
  4. +1 −1 package.json
  5. +1 −1 test/alltests.js
View
2 lib/id3v2_frames.js
@@ -92,7 +92,7 @@ exports.readData = function readData(b, type, flags, major) {
var split = text.trim().split(/\((.*?)\)/g).filter(function(val) { return val !== ''; });
//match everything inside parentheses
var paired = [];
- for (var i in split) {
+ for (var i=0; i <= split.length; i++) {
if (split.hasOwnProperty(i)) {
var cur = split[i];
if (!isNaN(parseInt(cur))) {
View
7 lib/index.js
@@ -12,7 +12,6 @@ ID3File.prototype.parse = function() {
metadata = {};
this.stream.once('data', function(result) {
- debugger;
//default to id3v1.1 if we cannot detect any other tags
var version = 'id3v1';
@@ -42,7 +41,7 @@ ID3File.prototype.parse = function() {
//rewrite to new alias
var mappedTo;
- for (var i in MAPPINGS) {
+ for (var i=0; i < MAPPINGS.length; i++) {
if (MAPPINGS[i].indexOf(event) > -1) {
mappedTo = MAPPINGS[i][0];
break;
@@ -83,9 +82,7 @@ ID3File.prototype.parse = function() {
metadata[mappedTo] = mdataObj;
}
};
-
- //processor.parse();
-
+
//re-emitting the same data event so the correct id3 processor picks up the stream from the start
//is it possible that the id3 processor could pick up the NEXT event before the first one is re-emitted?
self.stream.emit('data', result);
View
2 lib/vorbis.js
@@ -43,7 +43,7 @@ vorbis.prototype.parse = function() {
//remember the page length incase the metadata
//spans across multiple pages
- for (var i=0; i<= v.length -1; i++) {
+ for (var i=0; i < v.length; i++) {
cb.pageLength += v[i];
}
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "musicmetadata",
"description": "Music metadata library for node, using pure Javascript.",
- "version": "0.0.6",
+ "version": "0.0.7",
"author": "Lee Treveil",
"engine": [ "node >=0.3.1" ],
"dependencies": {
View
2 test/alltests.js
@@ -5,7 +5,7 @@ if (module == require.main) {
'test-id3v2.3.js', 'test-id3v2.4.js', 'test-id4.js',
'test-vorbis.js'];
- for (var i in tests) {
+ for (var i=0; i < tests.length; i++) {
var test = spawn(process.execPath, [tests[i]]);
test.stdout.on('data', function(data) {

0 comments on commit 4591c26

Please sign in to comment.