generateTokens = ({ key, type, value, amount, refDepth = 1 }) => {
  const result = {};
  Array(refDepth)
    .fill(null)
    .forEach((_, refIndex) => {
      result[`${key}-ref${refIndex}`] = Object.fromEntries(
        Array(amount)
          .fill(null)
          .map((_, index) => [
            `${key}${index}`,
            { value: refIndex > 0 ? `{${key}-ref${refIndex - 1}.${key}${index}}` : value, type },
          ]),
      );
    });

  return result;
}
Utility to programmatically generate large sets of tokens

Example:
generateTokens({ key: 'fw', amount: 3000, value: 'Regular', type: 'fontWeight', refDepth: 3 });

Result:

{
  fw-ref0: { // base, minimum
    fw0: {
      value: 'Regular',
      type: 'fontWeight'
    },
    fw1: {
      value: 'Regular',
      type: 'fontWeight'
    },
    ...
  },
  fw-ref1: { // refs the previous sibling, if refDepth > 1
    fw0: {
      value: '{fw-ref0.fw0}',
      type: 'fontWeight'
    },
    fw1: {
      value: '{fw-ref0.fw1}',
      type: 'fontWeight'
    },
    ... (repeat, depends on `amount`)
  },
  ... (repeat, depends on `refDepth`)
}

@param {*} param0
@returns