function onAdd() {
    if ( mod.RED === null ) return
    const RED = mod.RED

    // Add some uibuilder specific utility functions to RED.util so they can be used inside function nodes
    RED.util.uib = {
        /** Recursive object deep find
         * @param {*} obj The object to be searched
         * @param {Function} matcher Function that, if returns true, will result in cb(obj) being called
         * @param {Function} cb Callback function that takes a single arg `obj`
         */
        deepObjFind: (obj, matcher, cb) => {
            if (matcher(obj)) {
                cb(obj)
            }
            for (const key in obj) {
                if (typeof obj[key] === 'object') {
                    RED.util.uib.deepObjFind(obj[key], matcher, cb)
                }
            }
        },

        /** Format a number to a given locale and decimal places
         * @param {number} inp Input number
         * @param {number} dp Number of output decimal places required (default=1)
         * @param {string} int Locale to use for number format (default=en-GB)
         * @returns {string} Formatted number as a string
         */
        dp: (inp, dp = 1, int = 'en-GB') => {
            return inp.toLocaleString(int, { minimumFractionDigits: dp, maximumFractionDigits: dp, })
        },

        /** Returns true/false or a default value for truthy/falsy and other values
         * @param {string|number|boolean|*} val The value to test
         * @param {any} deflt Default value to use if the value is not truthy/falsy
         * @returns {boolean|any} The truth! Or the default
         */
        truthy: (val, deflt) => {
            let ret
            if (['on', 'On', 'ON', 'true', 'True', 'TRUE', '1', true, 1].includes(val)) ret = true
            else if (['off', 'Off', 'OFF', 'false', 'False', 'FALSE', '0', false, 0].includes(val)) ret = false
            else ret = deflt
            return ret
        },

        // WARNING: Plugins are defined EARLY so they won't have access to the uibuilder library/startup data yet
        //          So some plugins are defined in the base uibuilder node instead.

        // In case another plugin defines more of these and is processed first
        ...RED.util.uib,
    }
}
Called when the plugin is added to the editor