Fix DeprecationWarning for node 7.x

This commit is contained in:
Moos 2016-12-22 12:47:48 -08:00
parent d2cbcecf2a
commit 220473102e
5 changed files with 12 additions and 9 deletions

View File

@ -289,7 +289,10 @@ See [bench/README](bench).
## Changes ## Changes
1.1 - 1.1.1
- Fix DeprecationWarning for node 7.x
1.1.0
- added seek() method - added seek() method
- added lexName property - added lexName property

View File

@ -11,7 +11,7 @@
"verbs" "verbs"
], ],
"description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.", "description": "wordpos is a set of part-of-speech utilities for Node.js using the WordNet database.",
"version": "1.1.0", "version": "1.1.1",
"homepage": "https://github.com/moos/wordpos", "homepage": "https://github.com/moos/wordpos",
"engines": { "engines": {
"node": ">=0.12" "node": ">=0.12"

View File

@ -178,7 +178,7 @@ function lookup(offsets, callback) {
function closeFile() { function closeFile() {
if (--self.refcount === 0) { if (--self.refcount === 0) {
//console.log(' ... closing', self.filePath); //console.log(' ... closing', self.filePath);
fs.close(self.fd); fs.closeSync(self.fd);
self.fd = null; self.fd = null;
} }
return Promise.resolve(); return Promise.resolve();

View File

@ -72,7 +72,7 @@ piper.wrapper = function(self, task /*, result...*/){
if (--self.refcount === 0) { if (--self.refcount === 0) {
//console.log(' ... closing', self.filePath); //console.log(' ... closing', self.filePath);
fs.close(self.fd); fs.closeSync(self.fd);
self.fd = null; self.fd = null;
} }
}; };

View File

@ -366,7 +366,7 @@ describe('seek()...', function() {
assert(err instanceof Error); assert(err instanceof Error);
assert.equal(err.message, 'offset must be valid positive number.'); assert.equal(err.message, 'offset must be valid positive number.');
done(); done();
}); }).catch(_.noop); // UnhandledPromiseRejectionWarning
}); });
it('should handle wrong offset', function(done) { it('should handle wrong offset', function(done) {
@ -376,7 +376,7 @@ describe('seek()...', function() {
assert.equal(err.message, 'Bad data at location ' + bad_offset); assert.equal(err.message, 'Bad data at location ' + bad_offset);
assert.deepEqual(result, {}); assert.deepEqual(result, {});
done(); done();
}); }).catch(_.noop); // UnhandledPromiseRejectionWarning;
}); });
it('should handle very large offset', function(done) { it('should handle very large offset', function(done) {
@ -386,7 +386,7 @@ describe('seek()...', function() {
assert.equal(err.message, 'no data at offset ' + bad_offset); assert.equal(err.message, 'no data at offset ' + bad_offset);
assert.deepEqual(result, {}); assert.deepEqual(result, {});
done(); done();
}); }).catch(_.noop); // UnhandledPromiseRejectionWarning;
}); });
it('should handle bad pos', function(done) { it('should handle bad pos', function(done) {
@ -394,13 +394,13 @@ describe('seek()...', function() {
assert(err instanceof Error); assert(err instanceof Error);
assert(/Incorrect POS/.test(err.message)); assert(/Incorrect POS/.test(err.message));
done(); done();
}); }).catch(_.noop); // UnhandledPromiseRejectionWarning;
}); });
it('should handle wrong pos', function(done) { it('should handle wrong pos', function(done) {
wordpos.seek(offset, 'v', function(err, result){ wordpos.seek(offset, 'v', function(err, result){
assert.equal(err.message, 'Bad data at location ' + offset); assert.equal(err.message, 'Bad data at location ' + offset);
}); }).catch(_.noop); // UnhandledPromiseRejectionWarning;
done(); done();
}); });