
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Construction in America relies a lot on the imperial mesuring system (which makes me extremely sad). I wanted a way to easily convert units on my website for readers that are only comfortable with one format. You can see the package at work at karelledru.com.
DISCLAMER: This package is not really production ready. There is still quite some work needed. Use at your own risk but feel free to open tickets or PRs if you want to use/contribute.
1/2"
(half an inch)6ft 4in
1.94m
Limitations:
'
and "
are respectively the shorthands for foot and inch, you cannot use these to separate thousands (like 1'000)Install via yarn/npm:
yarn global add measures
And start using:
Measures = require('measures')
new Measures().from('6ft 4in 1/2').to('m')
from(string)
Measures can parse single units:
10cm
28 m
6 inches
As well as combined units and fractions:
6' 4"
5" 1/2
5 1/2 "
The supported units are:
m
, meter
, meters
km
, kilometer
, kilometers
cm
, centimeter
, centimeters
mm
, millimeter
, millimeters
'
, ft
, foot
, feet
"
, in
, inch
, inches
yd
, yard
, yards
mi
, mile
, miles
to(stringOrArray)
Measures can convert a string to a single unit or multiple ones. You can use any of the units listed above. You can also add a precision (replace * with the unit you want):
*-round
will return the rounded value*-floor
will return the rounded value downwards to the closest integer*-ceil
will return the rounded value upwards to the closest integer*-n
where n
is an integer (like *-2
) will allow n decimal digitFor inches, you might want to format it as a fraction. You can do that with the precision:
*-/n
where n
is an integer in [2, 4, 8, 16, 32, 64]. So *-/8
will return fraction where the denominator is 8 or less.Measures can parse any fraction you input but only returns an irreducible fraction up to a /64
precision.
Do what you want with this. Feel free to contribute, fork, love, hate...
IMPORTANT: I will not merge a PR without proper testing and documentation.
FAQs
Convert metric to imperial and vice versa
We found that measures demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.