Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
jscodeshift - get count of all imports from a module in project

I'm playing around with jscodeshift.

My goal is to get count of all imports from a particular module in a project

import { Circle, Triangle, Rectangle } from 'geometry';

results in

{ Circle: 1, Triangle: 1, Rectangle: 1 }

I have kind of achieved what I wanted here But the only issue is that I want these stats for a whole project instead of single file.

Any idea how can I achieve this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Not sure if I understand this correctly, are you trying to import everything from within a module without having to explicitly type their names (Circle, Triangle, etc)? Or this might help:

export const Foo = 1;
export const Bar = 2;

// geometry2.js|ts
export const Biz = 3;

// index.js|ts 
import * as counts from './geometry';
import * as counts2 from './geometry2';

const data = { ...counts, ...counts2 };
console.log(data); // logs {Foo: 1, Bar: 2, Biz: 3}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda