Skip to content

Instantly share code, notes, and snippets.

@bradgignac
Last active December 29, 2015 09:09
Show Gist options
  • Save bradgignac/7647856 to your computer and use it in GitHub Desktop.
Save bradgignac/7647856 to your computer and use it in GitHub Desktop.
Servo Boolean Observable
goog.provide('servo.boolean');
goog.require('servo.observable');
servo.boolean = function (value, options) {
return servo.observable(value, function (value) {
return typeof value === 'boolean';
}, options);
};
goog.provide('servo.string');
goog.require('servo.observable');
servo.string = function (value, options) {
return servo.observable(value, function (value) {
return typeof value === 'string';
}, options);
};
@bradgignac
Copy link
Author

Example Usage:

var default, nullable;

default = servo.boolean(true);
nullable = servo.boolean(null, { nullable: true });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment