Module:UtilsTable/Documentation/Snippets

local p = {}

local utilsString = require("Module:UtilsString") local utilsTable = require("Module:UtilsTable")

function p.keyBy1 local characters = { {			name = "Link", game = "TWW", age = 10, },		{			name = "Link", game = "TP", age = 17 },	}	return utilsTable.keyBy(characters, function(character)		return character.game .. " " .. character.name	end) end

function p.filter1 local args = { "foo", nil, "", "bar" } return utilsTable.filter(args, utilsString.notEmpty) end

function p.mapValues1 local templateArgs = { arg1 = " foo ", arg2 = "bar\n", }	return utilsTable.mapValues(templateArgs, mw.text.trim) end

return p