code: function dictsort(val, caseSensitive, by) {
    if (!lib.isObject(val)) {
      throw new lib.TemplateError('dictsort filter: val must be an object');
    }
  
    let array = [];
    // deliberately include properties from the object's prototype
    for (let k in val) { // eslint-disable-line guard-for-in, no-restricted-syntax
      array.push([k, val[k]]);
    }
  
    let si;
    if (by === undefined || by === 'key') {
      si = 0;
    } else if (by === 'value') {
      si = 1;
    } else {
      throw new lib.TemplateError(
        'dictsort filter: You can only sort by either key or value');
    }
  
    array.sort((t1, t2) => {
      var a = t1[si];
      var b = t2[si];
  
      if (!caseSensitive) {
        if (lib.isString(a)) {
          a = a.toUpperCase();
        }
        if (lib.isString(b)) {
          b = b.toUpperCase();
        }
      }
  
      return a > b ? 1 : (a === b ? 0 : -1); // eslint-disable-line no-nested-ternary
    });
  
    return array;
  }
docs: eslint-disable-line dot-notation