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+2150⅐0.142
U+2151⅑0.111
U+2152⅒0.1
U+2153⅓0.333
U+2154⅔0.666
U+2155⅕0.2
U+2156⅖0.4
U+2157⅗0.6
U+2158⅘0.8
U+2159⅙0.166
U+215A⅚0.833
U+215B⅛0.125
U+215C⅜0.375
U+215D⅝0.625
U+215E⅞0.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.