Comparing version 0.0.2 to 0.0.3
@@ -7,2 +7,4 @@ /*! | ||
'use strict'; | ||
const {NodeUnbound} = require('bindings')('unbound'); | ||
@@ -21,5 +23,2 @@ | ||
setOption(opt, val) { | ||
if (typeof opt === 'string') | ||
opt += ':'; | ||
if (val == null) | ||
@@ -34,11 +33,8 @@ val = ''; | ||
return super.setOption(opt, val); | ||
return super.setOption(colon(opt), val); | ||
} | ||
getOption(opt, val) { | ||
if (typeof opt === 'string') | ||
opt += ':'; | ||
getOption(opt) { | ||
const val = super.getOption(colon(opt)); | ||
const val = super.getOption(opt); | ||
if (val == null) | ||
@@ -56,3 +52,3 @@ return null; | ||
if (/^[0-9]+$/.test(val)) | ||
if (isNumber(val)) | ||
return parseInt(val, 10); | ||
@@ -88,6 +84,6 @@ | ||
this.finalized = true; | ||
return super.removeZone(name); | ||
return super.removeData(data); | ||
} | ||
resolve(name, rrtype = 1, rrclass = 1) { | ||
resolve(qname, qtype = 1, qclass = 1) { | ||
this.finalized = true; | ||
@@ -105,3 +101,3 @@ return new Promise((resolve, reject) => { | ||
try { | ||
super.resolve(fqdn(name), rrtype, rrclass, cb); | ||
super.resolve(fqdn(qname), qtype, qclass, cb); | ||
} catch (e) { | ||
@@ -118,9 +114,13 @@ reject(e); | ||
function convert(items) { | ||
return { | ||
msg: items[0], | ||
secure: items[1], | ||
bogus: items[2], | ||
reason: items[3] | ||
}; | ||
function colon(opt) { | ||
if (typeof opt !== 'string') | ||
return opt; | ||
if (opt.length === 0) | ||
return opt; | ||
if (opt[opt.length - 1] !== ':') | ||
return `${opt}:`; | ||
return opt; | ||
} | ||
@@ -141,2 +141,21 @@ | ||
function convert(items) { | ||
return { | ||
msg: items[0], | ||
secure: items[1], | ||
bogus: items[2], | ||
reason: items[3] | ||
}; | ||
} | ||
function isNumber(str) { | ||
if (typeof str !== 'string') | ||
return false; | ||
if (str.length < 1 || str.length > 15) | ||
return false; | ||
return /^[0-9]{1,15}$/.test(str); | ||
} | ||
/* | ||
@@ -143,0 +162,0 @@ * Expose |
{ | ||
"name": "unbound", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Bindings to libunbound for node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29366
216