transition = function (selection, duration, delay, name) {
    if (config.disableTransitions || duration <= 0) {
        return selection;
    }

    let s = selection.transition(name);

    if (duration >= 0 || duration !== undefined) {
        s = s.duration(duration);
    }
    if (delay >= 0 || delay !== undefined) {
        s = s.delay(delay);
    }

    return s;
}
Start a transition on a selection if transitions are globally enabled
({@link disableTransitions} is false) and the duration is greater than zero; otherwise return
the selection. Since most operations are the same on a d3 selection and a d3 transition, this
allows a common code path for both cases.
@function transition
@param {d3.selection} selection - the selection to be transitioned
@param {Number|Function} [duration=250] - the duration of the transition in milliseconds, a
function returning the duration, or 0 for no transition
@param {Number|Function} [delay] - the delay of the transition in milliseconds, or a function
returning the delay, or 0 for no delay
@param {String} [name] - the name of the transition (if concurrent transitions on the same
elements are needed)
@returns {d3.transition|d3.selection}