Chrome Extension

Bind external value inside .map javascript

setFornecedorValue(){
    return this.userContext.getFornecedor().cnpjCpf; 
  }

  montarPedidos = (pedidos: any) => {
    const self = this;

    return pedidos.map(function (item: any) {  
      return {...item, cnpjFornecedor: self.setFornecedorValue() }; 
    });
  }

  montarPedidos(arrayValues);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Was this helpful?
0 Comments
Join Devsheet Ask a Question