Thanks, @rbuckton! Those are all great suggestions. I think I learned a thing or two too
One other option that @theScottyJam mentioned here in my earlier Functional Destructuring proposal was to use the extensions proposal, like this:
for (const article of apiResponse) {
const {
title,
subtitle,
content,
category,
::buildSlug: slug,
::getDaysSince: date,
::getWordCount: wordCount,
::getCharCount: charCount,
} = article;
}
In the example we looked at above, it might look like this:
const {
::getPieceName: pieceName,
::getPieceKey: pieceKey,
::getPieceColor: pieceColor,
::getStartPos: startPos,
::getCurrentPos: currentPos,
::getPieceAlg: pieceAlg,
::getPiecePos: piecePos,
::getMoveCount: moveCount,
::checkIfCurrentPiece: isCurrentPiece,
::checkIfOpponentPiece: isOpponentPiece,
} = piece;
If this works as he suggests, this should do exactly what I'm looking for here.
@hax would you mind shedding some light on this, seeing as you appear to be the author of that proposal?