mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 04:21:35 +00:00
chore: add proper documentation (#763)
* chore: generate API ref using `typedoc` * chore: declutter readme and add links to ytjs.dev * chore: clean up
This commit is contained in:
30
docs/api/namespaces/Utils/functions/findFunction.md
Normal file
30
docs/api/namespaces/Utils/functions/findFunction.md
Normal file
@@ -0,0 +1,30 @@
|
||||
[youtubei.js](../../../README.md) / [Utils](../README.md) / findFunction
|
||||
|
||||
# Function: findFunction()
|
||||
|
||||
> **findFunction**(`source`, `args`): [`FindFunctionResult`](../type-aliases/FindFunctionResult.md) \| `undefined`
|
||||
|
||||
Finds a function in a source string based on the provided search criteria.
|
||||
|
||||
## Parameters
|
||||
|
||||
• **source**: `string`
|
||||
|
||||
• **args**: [`FindFunctionArgs`](../type-aliases/FindFunctionArgs.md)
|
||||
|
||||
## Returns
|
||||
|
||||
[`FindFunctionResult`](../type-aliases/FindFunctionResult.md) \| `undefined`
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const source = '(function() {var foo, bar; foo = function() { console.log("foo"); }; bar = function() { console.log("bar"); }; })();';
|
||||
const result = findFunction(source, { name: 'bar' });
|
||||
console.log(result);
|
||||
// Output: { start: 69, end: 110, name: 'bar', node: { ... }, result: 'bar = function() { console.log("bar"); };' }
|
||||
```
|
||||
|
||||
## Defined in
|
||||
|
||||
[src/utils/Utils.ts:288](https://github.com/LuanRT/YouTube.js/blob/eb21af33db708f0355f4fb15881f5d4fabc7b06c/src/utils/Utils.ts#L288)
|
||||
Reference in New Issue
Block a user