This article is based on information from these blog posts: Building a Knockout.js Extender for Boolean Values and Alternative Approach to Extenders in Knockout.js.

Extender to help Knockout exchange bit/boolean values properly with SQL Server and other cases where the underlying data source requires boolean values rather than strings.

First form. This form creates a new extender:

ko.extenders["booleanValue"] = function (target) {
    target.formattedValue = ko.computed({
        read: function () {
            if (target() === true) return "Yes";
            else if (target() === false) return "No";
        },
        write: function (newValue) {
             if (newValue) {
                if (newValue === "Yes") target(true);
                else if (newValue === "No") target(false);
            }
        }
    });
};

Reference the extender in your model in this manner:

this.isSomeStateOrCondition = ko.observable(false).extend({ booleanValue: null });

Second form. This form attaches the functionality to the .fn extension point of ko.observable().

ko.observable.fn.booleanValue = function () {
    var formattedValue = ko.computed({
        read: function () {
            if (this() === true) return "Yes";
            else if (this() === false) return "No";
        },
        write: function (newValue) {
            if (newValue) {
                if (newValue === "No") this(false);
                else if (newValue === "Yes") this(true);
            }
        }
    }, this);
 
    this.formattedValue = formattedValue;
    this.formattedValue(this());
    return this;
};

To use this, do the following:

this.isSomeStateOrCondition = ko.observable(false).booleanValue(); // you can chain other such fn() extensions here