Software /
code /
prosody-modules
Comparison
mod_rest/jsonmap.lib.lua @ 4744:f478855f4565
mod_rest: Stop search when an implied type is determined
Optimization only, as the iteration order is undefined. And not much
since there's not that many entries in the implied_types map.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 04 Nov 2021 20:13:43 +0100 |
parent | 4743:0a501df823fd |
child | 4746:88f5e12c8351 |
comparison
equal
deleted
inserted
replaced
4743:0a501df823fd | 4744:f478855f4565 |
---|---|
476 local t_type = str(t.type); | 476 local t_type = str(t.type); |
477 if t_type == nil then | 477 if t_type == nil then |
478 for k, implied in pairs(implied_types) do | 478 for k, implied in pairs(implied_types) do |
479 if t[k] then | 479 if t[k] then |
480 t_type = implied; | 480 t_type = implied; |
481 break; | |
481 end | 482 end |
482 end | 483 end |
483 end | 484 end |
484 local kind = str(t.kind) or kind_by_type[t_type]; | 485 local kind = str(t.kind) or kind_by_type[t_type]; |
485 if not kind then | 486 if not kind then |