Options
All
  • Public
  • Public/Protected
  • All
Menu

pretty-ts-imports (a.k.a. primp)

These are all the main components of primp. If you wish to include anything in your own program, you can mostly do it with these classes.

You can easily import the ImportSorter, ImportSeparator and ImportIntegrator, as well as the FileManager to load in your typescript files and work with them in your code.

// maybe something like this
import {
FileManager,
ImportSorter,
ImportIntegrator
} from "pretty-ts-imports";

let fileManager = new FileManager(yourTSConfigPath, someOfYourFiles);
let sorter = new ImportSorter(yourGeneratedRules, []);
let integrator = new ImportIntegrator({});
for (let imported of fileManager.imports.values()) {
let integrated = integrator.integrate(imported.imports);
// write your integrated content somewhere
}

If you create custom functions for your primp config, you may use the function interfaces ImportCompareFunction, ImportElementCompareFunction and SeparateByFunction. They help you make sure you are designing a correct comparator function.

For examples check this. Especially the example compare function.

Index

Generated using TypeDoc