Skip to content

Instantly share code, notes, and snippets.

@aaronoah
Created June 2, 2019 14:51
Show Gist options
  • Save aaronoah/cd2eb497b64c9843c116ae77844cf3f0 to your computer and use it in GitHub Desktop.
Save aaronoah/cd2eb497b64c9843c116ae77844cf3f0 to your computer and use it in GitHub Desktop.
GSoC 2018 - code snippets
function createStringFormat(FieldFormat) {
return class StringFormat extends FieldFormat {
_convert(val) {
return String(val);
}
static id = 'string';
static title = 'String';
static fieldType = [
'number',
'boolean',
...
]
}
}
fieldFormats.register(createStringFormat);
fieldFormats._defaultMap = {
_default_: { id: 'string', params: {} }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment