Skip to content

Instantly share code, notes, and snippets.

View CarlosDanielDev's full-sized avatar
:octocat:
debugging

Carlos Daniel CarlosDanielDev

:octocat:
debugging
View GitHub Profile
import React from 'react'
export default class JsonToCsv extends React.Component{
// função que faz Download do Arquivo .csv
download(data){
const blob = new Blob([data], {type: 'text/csv'})
// console.log(blob)
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.setAttribute('hidden', '')
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'i', '--save', 'node-sass' ]
2 info using npm@6.9.0
3 info using node@v11.13.0
4 verbose npm-session 1e7ad1293dfec754
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/node-sass 25ms (from cache)
8 silly pacote tag manifest for node-sass@latest fetched in 39ms
9 timing stage:loadCurrentTree Completed in 5013ms
const axios = require('axios');
module.exports.getDadosMonit = async (idMonitoramento, xtoken, validate, idDominio) =>
await axios.all([
axios({
method: 'post',
url: 'https://api.smgeo.com.br/',
data: {
sessao: 'monitoramento_socioambiental',
acao: 'listar',
dados: {
https://tecadmin.net/install-latest-nodejs-npm-on-debian/
const newArrayFromNumber = length => Array.from({ length })
const range = (max, min = 0) => {
const length = max - min
return newArrayFromNumber(length)
.map((_, index) => ({ number: index + min }))
}
const arr = range(25, 5)
// array
const result = [{
"id":1,
"item":8,
"dados":[
{
"valor":"valor1"
},
{
"valor":"valor2"
const anotherFucntion = async function(){
for(const iterable of arrayDeRequests){
await requestHere
}
}
//gera array de acordo com o nmero passando no parametro da função newArrayFromNumber(10)
const newArrayFromNumber = length => Array.from({ length })
// gera um array ex: const arr = [{numero:1}, {numero:2}...]
const arr = newArrayFromNumber(10)
.map((_, index) => ({ numeroGta: index + 1, serieGta:'J'}))
console.log(arr)
const data = [
{
"idLote": 46,
"nfs": "01",
"data_lote_nfs": "2019-03-02T03:00:00.000Z",
"unidade": "Unidade Teste",
"grupo": "Walmart",
"nome_dominio": "FRIGOL",
"dominio": 11,
"idUnidade": 30
function1() return ([{
"info1": "teste",
"info2": "teste",
"info3":"teste"
"idLote": 50
},
{
"info1": "teste",