module Unicode::Emoji

def self.get_codepoint_value(char)

def self.get_codepoint_value(char)
  ord = nil
  if char.valid_encoding?
    ord = char.ord
  elsif char.encoding.name == "UTF-8"
    begin
      ord = char.unpack("U*")[0]
    rescue ArgumentError
    end
  end
  if ord
    ord
  else
    raise(ArgumentError, "Unicode::Emoji must be given a valid string")
  end
end

def self.list(key = nil, sub_key = nil)

Returns ordered list of Emoji, categorized in a three-level deep Hash structure
def self.list(key = nil, sub_key = nil)
  return LIST unless key || sub_key
  if LIST_REMOVED_KEYS.include?(key)
    $stderr.puts "Warning(unicode-emoji): The category of #{key} does not exist anymore"
  end
  LIST.dig(*[key, sub_key].compact)
end

def self.properties(char)

Source: see https://www.unicode.org/Public/16.0.0/ucd/emoji/emoji-data.txt

See PROPERTY_NAMES constant for possible properties
Return Emoji properties of character as an Array or nil
def self.properties(char)
  ord = get_codepoint_value(char)
  props = INDEX[:PROPERTIES][ord]
  if props
    props.map{ |prop| PROPERTY_NAMES[prop] }
  else
    # nothing
  end
end