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
| toJson(){ | |
| let _obj: any = {}; | |
| let _str:string = ""; | |
| for (const key in this) { | |
| if (this.hasOwnProperty(key)) { | |
| _str = key; | |
| _str = _str.replace(_str.charAt(0),""); | |
| _obj[_str] = this["_"+_str]; | |
| } | |
| } |
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 states = [ | |
| { | |
| value: 'ac', | |
| label: 'Acre', | |
| key: 'ac', | |
| }, { | |
| value: 'al', | |
| label: 'Alagoas', | |
| key: 'al', | |
| }, { |
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
| /** | |
| * Converts a string monetary value 9,00 to a integer | |
| * @param {String} stringValue | |
| */ | |
| const stringMoneyToCents = (stringValue) => { | |
| const regexCleanStr = new RegExp( | |
| /^[0-9]*$/g, | |
| ); | |
| const regexRemoveDots = new RegExp( |
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
| git fetch upstream | |
| git checkout master | |
| git merge upstream/master |
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 removeObjKeys: <T>(obj: T, keys: string[]) => T = (obj, keys) => { | |
| const objectKeys: string[] = Object.keys(obj); | |
| keys.forEach((key: string) => { | |
| const isPresentKey = objectKeys.find((objKey: string) => objKey === key); | |
| if (isPresentKey) { | |
| delete obj[key]; | |
| } | |
| }); |
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
| export default function = (lenght) => Array(lenght).fill(0).map((e, i) => i); |
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
| /** | |
| This a simple function to create the Holder Name of a Credit Card, mainly based | |
| on the pattern addopted at NuBank | |
| **/ | |
| const names = [ | |
| "Vini Lins", | |
| "Mateus Andrade da Costa Santos", | |
| "Bruno Dal Santos", | |
| "Helena Strada Franco de Souza", |
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 removeObjectKey = (target, key) => { | |
| Object.keys(target).forEach((objKey) => { | |
| if (typeof target[objKey] === "object") { | |
| return removeObjectKey(target[objKey], key); | |
| } | |
| if (objKey.toLowerCase() === key) { | |
| delete target[objKey]; | |
| } | |
| }); |