This file contains 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 moment from 'moment'; | |
export function extractColDocumentData(data) { | |
let dataString = data.barcodes[0]?.data.replace('PubDSK', '0'); | |
const sI = dataString.match('[a-zA-Z]').index; | |
dataString = dataString.substring(sI - 10); | |
const idNumber = dataString.substring(0, 10).replace(/^0+/,''); | |
const lastName1 = capitalize(dataString.substring(10, 30).replace(/�/g, '')); |
This file contains 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 moment from 'moment'; | |
import { capitalize } from './helpers'; | |
// Data comes directly from react-native-camera onGoogleVisionBarcodesDetected method | |
export function extractColDocumentData(data) { | |
const dataArray = data.barcodes[0].data.replace(/[^A-Za-z0-9+]+/g, ' ').split(' '); | |
let indexMod = 0; | |
let idNumber; |
This file contains 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 mascota = { | |
nombre: 'Tommy', | |
tipo: 'Perro' | |
}; | |
const mascotas = [mascota]; | |
mascota.nombre = 'Tomas'; | |
mascotas[0] = 'Moficado'; |
This file contains 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 mascota = "Perro"; | |
mascota = "Gato"; |
This file contains 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
var mascota = "Perro"; | |
console.log(mascota); | |
function cambiarMascota() { | |
let origen = "Colombia"; | |
mascota = "Gato"; | |
console.log("Mi mascota es un: " + mascota); |
This file contains 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
mascota = "Perro"; | |
console.log(mascota); | |
function cambiarMascota() { | |
mascota = "Gato"; | |
console.log("Mi mascota es un: " + mascota); | |
}; |
This file contains 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
var mascota = "Perro"; | |
console.log(mascota); | |
function cambiarMascota() { | |
mascota = "Gato"; | |
console.log("Mi mascota es un: " + mascota); | |
}; |
This file contains 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
async function startCallbackHell() { | |
try { | |
const res1 = await callback1(params); | |
const res2 = await callback2(res1); | |
const res3 = await callback3(res2); | |
const res4 = await callback4(res3); | |
const res5 = await callback5(res4); | |
} catch (error) { | |
// Do something with the error | |
} finally { |
This file contains 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
function startCallbackHell() { | |
callback1(params) | |
.then(callback2)) // Callback2 | |
.then(callback3) // Callback3 | |
.then(callback4) // Callback4 | |
.then(callback5) // Callback5 | |
.catch((error) => { */Do something with the error*/ }) // Catch error | |
} | |
const callback1 = (params) => { |
This file contains 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
function startCallbackHell() { | |
callback1(params, (error, response) => { | |
if (error) { | |
// Do something with the error | |
} else { | |
callback2({ response }, (error, response) => { | |
if (error) { | |
// Do something with the error | |
} else { | |
callback3({ response }, (error, response) => { |