Skip to content

Instantly share code, notes, and snippets.

@cschuff
Last active May 30, 2019 09:05
Show Gist options
  • Save cschuff/f5ce22a17ad4d9223bb3653d42126f84 to your computer and use it in GitHub Desktop.
Save cschuff/f5ce22a17ad4d9223bb3653d42126f84 to your computer and use it in GitHub Desktop.
Valid SAPUI5 property types
// found in https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/base/DataType.js
"any"
"boolean"
"int"
"float"
"string"
"object"
"function"
// arrays like this
"string[]"
// Formerly (from sap-ui-core-dbg.js)
var PREDEFINED_TYPES = {
"any" :
createType("any", {
defaultValue : null,
isValid : function(vValue) {
return true;
}
}),
"boolean" :
createType("boolean", {
defaultValue : false,
isValid : function(vValue) {
return typeof vValue === "boolean";
}
}),
"int" :
createType("int", {
defaultValue : 0,
isValid : function(vValue) {
return typeof vValue === "number" && Math.floor(vValue) == vValue;
}
}),
"float" :
createType("float", {
defaultValue : 0.0,
isValid : function(vValue) {
return typeof vValue === "number";
}
}),
"string" :
createType("string", {
defaultValue : "",
isValid : function(vValue) {
return typeof vValue === "string" || vValue instanceof String;
}
}),
"object" :
createType("object", {
defaultValue : null,
isValid : function(vValue) {
return typeof vValue === "object" || typeof vValue === "function";
}
})
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment