Module:languages/javascript-interface/sandbox

Hello, you have come here looking for the meaning of the word Module:languages/javascript-interface/sandbox. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:languages/javascript-interface/sandbox, but we will also tell you about its etymology, its characteristics and you will know how to say Module:languages/javascript-interface/sandbox in singular and plural. Everything you need to know about the word Module:languages/javascript-interface/sandbox you have here. The definition of the word Module:languages/javascript-interface/sandbox will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:languages/javascript-interface/sandbox, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

function export.get_language_by_prefix(frame)
	local prefix = frame.args
	if not prefix or prefix == "" then
		return
	end
	
	local Map = require "Module:User:Erutuon/lang_stuff/map"
	local name_to_code = require "Module:languages/canonical names"
	
	local lower, find
	if prefix:find("") then
		lower, find = mw.ustring.lower, mw.ustring.find
	else
		lower, find = string.lower, string.find
	end
	
	return require "Module:JSON".toJSON(Map:new(name_to_code)
		:filter(function (code, name)
			return find(lower(name), "^" .. prefix) ~= nil
		end)
		:map(function (code, name)
			return { name, code }
		end)
		:values())
end

return export