View Source Modkit.Mod (modkit v0.4.2)
Link to this section Summary
Functions
Returns the module that is a local root of all given modules. That is a common prefix of all given modules that is also a module from the list.
Given two module names, returns the module name that is a prefix of the other,
or nil if the two names are disjoint.
Link to this section Functions
Returns the module that is a local root of all given modules. That is a common prefix of all given modules that is also a module from the list.
For instance, modules A and A.B have a common prefix that is A, and A
is provided as an argument, so it will be returned.
But if only A.B and A.C are provided, the common prefix A will not be
returned since it is not one of the arguments.
examples
Examples
iex> local_root([A, A.B])
A
iex> local_root([A.B, A.C, A])
A
iex> local_root([A.B, A.C])
nil
iex> local_root([])
nil
Given two module names, returns the module name that is a prefix of the other,
or nil if the two names are disjoint.
See local_root/1.
examples
Examples
iex> local_root(A, A.B)
A
iex> local_root(A.B, A.C)
nil