Module:Utils

-- Intra-wiki Utilities -- Used for metamodule, or for template use

--[==[Modules]==]-- local getArgs = require("Dev:Arguments").getArgs;

--[==[Utils Module]==]-- local utils = {};

-- Metamodules utils.create_wrapper = function(func, firstArg) -- Wrap a metamodule function for use in templates return function(frame) return frame:preprocess(firstArg and func(getArgs(frame)[1]) or func(getArgs(frame))); end end

utils._trim = function(str) -- Trims leading and trailing whitespace from a string return str:match("^%s*(.-)%s*$"); end

-- Template modules utils.trim = utils.create_wrapper(utils._trim, true);

--- return utils;