Use the codemap.lua module for mapping codes or validating codes. You can map one set of codes to another set of codes, or validate code membership in a set. The module allows you to set up a code mapping table including a default value to be returned if there is no matching code.
This page presents the codemap module by itself, so you can copy it directly into your project. However if you prefer to experiment with some sample code that uses the codemap module then you should consider importing our Map data fields channel from the Builtin: Iguana Tools repository.