Skip to main content

Unicode Fractions

@magrinj/parse-ingredients automatically converts Unicode fraction characters to their decimal equivalents during parsing.

Supported Fractions

UnicodeCharacterDecimal
U+00BC¼0.25
U+00BD½0.5
U+00BE¾0.75
U+21500.142
U+21510.111
U+21520.1
U+21530.333
U+21540.666
U+21550.2
U+21560.4
U+21570.6
U+21580.8
U+21590.166
U+215A0.833
U+215B0.125
U+215C0.375
U+215D0.625
U+215E0.875

Mixed Numbers

Unicode fractions can be combined with whole numbers:

import parse from '@magrinj/parse-ingredients';

parse('2½ cups flour');
// { quantity: '2.5', unit: 'cup', ingredient: 'flour', ... }

parse('1¾ teaspoons salt');
// { quantity: '1.75', unit: 'teaspoon', ingredient: 'salt', ... }

These are commonly found in recipe content copied from websites, PDFs, or cookbooks that use special typography.