Mojibake.Property (Mojibake v0.8.0)

Copy Markdown View Source

The Unicode properties that Mojibake stores per codepoint.

A property is an atom made from its long name in PropertyAliases.txt, such as :alphabetic, :white_space, :extended_pictographic, or :line_break.

Binary properties are true or false for each codepoint; query them with Mojibake.Char.property?/2. Enumerated properties have one value per codepoint, such as :alphabetic for the :line_break of "A"; query them with Mojibake.Char.property/2. Their values are atoms made from the long value names in PropertyValueAliases.txt.

The enumerated properties are :east_asian_width, :grapheme_cluster_break, :indic_conjunct_break, :joining_type, :line_break, :script, :sentence_break, and :word_break. General_Category, Bidi_Class, Canonical_Combining_Class, and Decomposition_Type come from Mojibake.Char.info/1 instead.

Summary

Types

t()

A property, such as :alphabetic.

Functions

Every property, binary and enumerated.

Return true if property is a binary property, and false if it is an enumerated one or not a property.

The values of the enumerated property, or nil if it is binary or not a property.

Types

t()

@type t() :: atom()

A property, such as :alphabetic.

Functions

all()

@spec all() :: [t()]

Every property, binary and enumerated.

Examples

iex> :white_space in Mojibake.Property.all()
true

binary?(property)

@spec binary?(t()) :: boolean()

Return true if property is a binary property, and false if it is an enumerated one or not a property.

Examples

iex> Mojibake.Property.binary?(:alphabetic)
true

iex> Mojibake.Property.binary?(:line_break)
false

values(property)

@spec values(t()) :: [atom()] | nil

The values of the enumerated property, or nil if it is binary or not a property.

Examples

iex> Mojibake.Property.values(:east_asian_width)
[:ambiguous, :fullwidth, :halfwidth, :neutral, :narrow, :wide]