@function em($target, $context: $base-font-size) {
    @return ($target / $context) * 1em;
}

// Usage:
font-size: em(18px);

// Go up to 18 px font size when in a 14 px context
font-size: em(18px, 14px);

// With modular scale it could look like this:
font-size: em(ms(2));
font-size: em(ms(2), ms(-1));