Fractale
  • Introduction
  • Philosophy
  • Usage
  • Options
  • Plugin
  • Provider
  • Bridge
  • Performance
  • Examples
    • Simple model
    • Inception model
    • Metadata model
    • Collection model
    • Self-reference model
    • Inheritance model
    • Form usage
    • RegExp key model
    • Global options
Powered by GitBook
On this page
Export as PDF
  1. Examples

Global options

PreviousRegExp key model

Last updated 5 years ago

Was this helpful?

CtrlK
  • Models
  • Run
  • Results

Was this helpful?

Models

const Global_Options = Fractale.create("Global_Options", {
    transformed: Number
});

Run

const { Global_Options } = module.exports.get();

const instance = new Global_Options({
    transformed: 39,
});

_.test(instance.transformed, 39, 'Error on global option transform accessor with type percentage');

instance.transformed = '10%';

_.test(instance.transformed, 0.1, 'Error on global option transform accessor with type percentage');

resolve(instance);

Results

{
    "uuid": "325dda13-7f10-4bc1-a212-c7eaa7e9beb6",
    "transformed": 0.1
}