mirror of
https://github.com/iconoir-icons/iconoir
synced 2024-06-09 09:22:24 +02:00
20 lines
484 B
JavaScript
20 lines
484 B
JavaScript
import path from 'node:path';
|
|
|
|
export function generateImport(name, from) {
|
|
if (Array.isArray(name)) name = `{${name.toString()}}`;
|
|
|
|
return `import ${name} from "${from}";`;
|
|
}
|
|
|
|
export function generateExport(name, from) {
|
|
const base = `export {${name.toString()}}`;
|
|
|
|
return from ? `${base} from "${from}";` : `${base};`;
|
|
}
|
|
|
|
export function toImportPath(input) {
|
|
input = input.split(path.sep).join(path.posix.sep);
|
|
|
|
return input.charAt(0) !== '.' ? `./${input}` : input;
|
|
}
|