Skip to content

Elixir dialect

Eric Pailleau edited this page Apr 17, 2025 · 3 revisions

NPM vs Elixir syntax cheat‐sheet

NPM/Elixir syntax equivalences

NPM Elixir Comment on Elixir syntax
'=' == Only version
> > Anything later than
< < Anything older than
>= >= Anything later or equal than
<= <= Anything older or equal than
and Condition and between versions
|| or Condition or between versions
~x.y.z ~> x.y.0 Allows patch-level changes if a minor version is specified on the comparator. Allows minor-level changes if not.
^x.y.z ~> x.y Allows changes that do not modify the left-most non-zero element in the [major, minor, patch] tuple

Conversion examples

Conversion will be done on the fly to NPM standard before evaluation.

input convert to
~> 2.0.0 >=2.0.0 <2.1.0
~> 2.1.2 >=2.1.2 <2.2.0
~> 2.1.3-dev >=2.1.3-dev < 2.2.0
~> 2.0 >=2.0.0 <3.0.0
~> 2.1 >= 2.1.0 <3.0.0

Clone this wiki locally