
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
parse-dimensions
Advanced tools
Parse physical object dimensions and convert them into a standardized form.
Parse physical object dimensions and convert them into a standardized form.
const pd = require("parse-dimensions");
console.log(pd.parseDimension("4in x 5in"));
// { original: '4in x 5in', unit: 'mm', width: 101.6, height: 127 }
console.log(pd.parseDimension("4.2cm x 5.1cm"));
// { original: '4.2cm x 5.1cm', unit: 'mm', width: 42, height: 51 }
You can see a full list of all the types of dimension strings handled in the test file.
npm install parse-dimensions
Parse a string that holds some dimensions and returns an object representing the dimensions. By default it assumes that the width is first. Pass a boolean as the second argument to assume the height is first.
Parse a string that holds a set of dimensions and returns an array of objects representing the dimensions. It assumes that the dimensions are separated by semicolons by default.
Convert a number from one dimension unit to another. For example:
convertNumber(10, "mm", "cm") will return 1.
Given a dimension object (as produced by parseDimension) convert it to use
a different dimension. Returns the modified dimension object.
Created by John Resig
FAQs
Parse physical object dimensions and convert them into a standardized form.
The npm package parse-dimensions receives a total of 10 weekly downloads. As such, parse-dimensions popularity was classified as not popular.
We found that parse-dimensions 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
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.