0.0.21 • Published 4 years ago
dimension-parser v0.0.21
dimension-parser
parse dimensions out of strings
install
npm install dimension-parser
or
bower install dimension-parser
examples
var dimensionParser = require('dimension-parser');
dimensionParser('171.5 x 141.5 cm (67.5 x 55.75 in.)', 'in'); // returns {width: "67.50", height: "55.75"}
// or
dimensionParser('171.5 x 141.5 x 141.5 cm (67.5 x 55¾ x 55 3/4 in.)', 'in'); // returns {width: "67.50", height: "55.75", length: "55.75"}
// or you can test if a string contains dimensions
dimensionParser.hasDimensions('foobar'); // returns false
// you can also provide a format (the default is WxHxL)
dimensionParser('171.5 x 141.5 x 141.5 cm (67.5 x 55¾ x 55 3/4 in.)', 'in', 'HxWxL'); // returns {height: "67.50", width: "55.75", length: "55.75"}
// and you can also tell the parser to be more strict
dimensionParser('171.5 x 141.5 x 141.5 cm (67.5 x 55¾ x 55 3/4 in.)', 'in', 'HxWxL', true);
0.0.21
4 years ago
0.0.20
8 years ago
0.0.19
8 years ago
0.0.18
8 years ago
0.0.17
8 years ago
0.0.16
9 years ago
0.0.15
9 years ago
0.0.14
9 years ago
0.0.13
9 years ago
0.0.12
9 years ago
0.0.11
9 years ago
0.0.10
9 years ago
0.0.9
9 years ago
0.0.8
9 years ago
0.0.7
9 years ago
0.0.6
9 years ago
0.0.5
9 years ago
0.0.4
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.0
9 years ago