Skip to content

Commit

Permalink
feat: export tsoogle as a function
Browse files Browse the repository at this point in the history
  • Loading branch information
Zlatin Stanimirov authored and Zlatin Stanimirov committed Nov 6, 2023
1 parent 9792707 commit e444483
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import { evaluateSearchQuery } from './src/evaluator'
import { parse } from './src/lexer'
import { prettify } from './src/prettyfier'

const tsFilePath = process.argv[2]
const tsConfigFilePath = process.argv[2]
const userSearchQuery = process.argv[3]

const searchQuery = parse(userSearchQuery)
evaluateSearchQuery(tsFilePath, searchQuery).forEach(func => {
console.log(prettify(func))
})
export function tsoogle (tsConfigFilePath: string, userSearchQuery: string): string {
const searchQuery = parse(userSearchQuery)
let output = ''
evaluateSearchQuery(tsConfigFilePath, searchQuery).forEach(func => {
output += `${prettify(func)}\n`
})
return output
}

console.log(tsoogle(tsConfigFilePath, userSearchQuery))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stanimirovv/tsoogle",
"version": "1.0.2",
"version": "1.0.4",
"description": "Find functions or methods by approximate signature - return type, argument types or both. Supports optional arguments, rest arguments and partial type checking.",
"main": "dist/index.js",
"bin": "dist/index.js",
Expand Down

0 comments on commit e444483

Please sign in to comment.