0.0.21 • Published 5 years ago

dimension-parser v0.0.21

Weekly downloads
49
License
MIT
Repository
github
Last release
5 years ago

dimension-parser Build Status

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

5 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.0

10 years ago