Skip to content

Commit

Permalink
Add table of contents to USAGE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
0pilatos0 committed Jan 2, 2024
1 parent 19d26c9 commit 8021f5a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
33 changes: 33 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@

Here are some of the utility functions and classes available in this library:

## Table of Contents

- [DateUtils](#dateutils)
- [addDays](#adddays)
- [currentDayName](#currentdayname)
- [subtractDays](#subtractdays)
- [currentDate](#currentdate)
- [getWeekNumber](#getweeknumber)
- [isLeapYear](#isleapyear)
- [currentYear](#currentyear)
- [currentMonthName](#currentmonthname)
- [differenceInDays](#differenceindays)
- [currentMonth](#currentmonth)
- [currentDay](#currentday)

- [MathUtils](#mathutils)
- [modulus](#modulus)
- [ceil](#ceil)
- [divide](#divide)
- [floor](#floor)
- [multiply](#multiply)
- [isPrime](#isprime)
- [sqrt](#sqrt)
- [subtract](#subtract)
- [add](#add)
- [pow](#pow)

- [StringUtils](#stringutils)
- [capitalize](#capitalize)
- [camelCase](#camelcase)
- [isPalindrome](#ispalindrome)
- [reverse](#reverse)


## DateUtils

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typejedi",
"version": "0.0.16",
"version": "0.0.17",
"module": "dist/index.mjs",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
18 changes: 18 additions & 0 deletions tools/generateDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,29 @@ function generateReadmeContent() {
return acc;
}, {} as { [key: string]: typeof utilityComments });

const toc = Object.keys(grouped)
.map((category) => {
const subItems = grouped[category]
.map(({ filePath }) => {
const fileName = path.basename(filePath).slice(0, -3);
return ` - [${fileName}](#${fileName.toLowerCase()})`;
})
.join("\n");
return `
- [${
category.charAt(0).toUpperCase() + category.slice(1)
}Utils](#${category}utils)
${subItems}`;
})
.join("\n");
return `
# Usage
Here are some of the utility functions and classes available in this library:
## Table of Contents
${toc}
${Object.keys(grouped)
.map(
(category) => `
Expand Down

0 comments on commit 8021f5a

Please sign in to comment.