Fix the async calls.
This is a breaking change. But that's okay, the previous behavior for async was just plain wrong and would crash the entire node process, which is unacceptable. A major version bump will be needed to release this.
This commit is contained in:
		
							
								
								
									
										14
									
								
								lib/po.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								lib/po.js
									
									
									
									
									
								
							| @@ -12,15 +12,7 @@ var PO = function () { | ||||
| }; | ||||
|  | ||||
| PO.prototype.save = function (filename, callback) { | ||||
|     fs.writeFile(filename, this.toString(), function (err) { | ||||
|         if (err) { | ||||
|             throw err; | ||||
|         } | ||||
|  | ||||
|         if (callback) { | ||||
|             callback(); | ||||
|         } | ||||
|     }); | ||||
|     fs.writeFile(filename, this.toString(), callback); | ||||
| }; | ||||
|  | ||||
| PO.prototype.toString = function () { | ||||
| @@ -54,10 +46,10 @@ PO.prototype.toString = function () { | ||||
| PO.load = function (filename, callback) { | ||||
|     fs.readFile(filename, 'utf-8', function (err, data) { | ||||
|         if (err) { | ||||
|             throw err; | ||||
|             return callback(err); | ||||
|         } | ||||
|         var po = PO.parse(data); | ||||
|         callback(po); | ||||
|         callback(null, po); | ||||
|     }); | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user