Skip to content

Commit 69b89c9

Browse files
authored
Merge pull request #1827 from ianhattendorf/fix/config-get-set-bool
Return/accept boolean for Config#get/setBool
2 parents c1acc68 + 856318c commit 69b89c9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

lib/config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@ var NodeGit = require("../");
33

44
var Config = NodeGit.Config;
55

6+
var _getBool = Config.prototype.getBool;
7+
var _setBool = Config.prototype.setBool;
8+
9+
/**
10+
* @async
11+
* @param {String} name The variable's name
12+
* @return {Boolean} The variable's value
13+
*/
14+
Config.prototype.getBool = function(name) {
15+
return _getBool.call(this, name)
16+
.then(result => Boolean(result));
17+
};
18+
19+
/**
20+
* @async
21+
* @param {String} name The variable's name
22+
* @param {Boolean} name The variable's value
23+
* @return {Number} 0 or an error code
24+
*/
25+
Config.prototype.setBool = function(name, value) {
26+
return _setBool.call(this, name, value ? 1 : 0);
27+
};
28+
629
// Backwards compatibility.
730
Config.prototype.getString = function() {
831
return this.getStringBuf.apply(this, arguments);

0 commit comments

Comments
 (0)