Babel plugin that compiles ES2015 computed properties to ES5-compatible code
88
Build a JavaScript module that creates objects with custom iteration behavior using Symbols and computed property syntax.
Create a module that exports a function createIterableRange(start, end, step) which returns an object that can be iterated using a for...of loop. The object should:
start to end (inclusive) with the given step size@generates
/**
* Creates an iterable object that generates a range of numbers.
*
* @param {number} start - The starting value of the range
* @param {number} end - The ending value of the range (inclusive)
* @param {number} step - The increment/decrement between values
* @returns {Object} An iterable object with Symbol.iterator as a computed property
* @throws {Error} Throws an error if step is 0
*/
function createIterableRange(start, end, step) {
// IMPLEMENTATION HERE
}
module.exports = { createIterableRange };Transforms computed properties with Symbol keys to ES5-compatible code.
Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-transform-es2015-computed-propertiesdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10