Examples of function currying using javascript
Examples of function currying using javascript export function transform ( str ) { // // Input: a3b3c6d5 // Output: aaaaabbbccccccddddd const strArray = str . split ( '' ); const map = {}; let lastChar = strArray [ 0 ]; let tmp = '' strArray . forEach ( char => { if ( isNaN ( char )) { map [ char ] = 0 ; if ( lastChar ) { map [ lastChar ] = Number ( tmp ); lastChar = char ; tmp = '' ; } } else { tmp += char ; } }) // map last characters repition here if ( tmp ) { map [ lastChar ] = Number ( tmp ); tmp = '' ; } let output = '' ; Object . keys ( map ). map ( key => { let charRepeatation = map [ key ]; for ( let i = 0 ; i < charRepeatation ; i ++) { output += key ; } }) return output ; } export function transformWithTimer ( input ) { var promise = new Promise ( res => { setTimeout (() =...