This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const transactions = [ | |
| { | |
| id: 3, | |
| sourceAccount: "A", | |
| targetAccount: "B", | |
| amount: 100, | |
| category: "eating_out", | |
| time: "2018-03-02T10:34:30.000Z", | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mask = (value, pattern) => { | |
| let index = 0; | |
| const string = value.toString(); | |
| return pattern.replace(/#/g, () => string[index++] || ''); | |
| } | |
| mask('1145820412', '(##) ####-####') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {eventChannel, END} from 'redux-saga' | |
| function createUploaderChannel(key, files){ | |
| return eventChannel(emit => { | |
| const onProgress = ({total, loaded}) => { | |
| const percentage = Math.round((loaded * 100) / total) | |
| emit(percentage) | |
| } | |