Skip to content

amirhasrati/code-snips

Repository files navigation

code-snips

Quickly generate code snippets from source code files.

import { snip } from "code-snips/snip";
import { readFileSync } from "fs";

// Snip start myFunc
const myFunc = () => {
    console.log("Hello World!");
}
// Snip end myFunc

const fileContent = readFileSync('./demo.ts', 'utf-8');
const snippet = snip(fileContent, "myFunc", "ts");
console.log(snippet);
Output:
const myFunc = () => {
    console.log("Hello World!");
}

Currently supports TypeScript and JavaScript.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published