mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 07:42:11 +00:00
chore: gen docs [skip ci]
This commit is contained in:
40
docs/api/namespaces/Utils/functions/findVariable.md
Normal file
40
docs/api/namespaces/Utils/functions/findVariable.md
Normal file
@@ -0,0 +1,40 @@
|
||||
[youtubei.js](../../../README.md) / [Utils](../README.md) / findVariable
|
||||
|
||||
# Function: findVariable()
|
||||
|
||||
> **findVariable**(`code`, `options`): [`ASTLookupResult`](../type-aliases/ASTLookupResult.md) \| `undefined`
|
||||
|
||||
Searches for a variable declaration in the given code based on specified criteria.
|
||||
|
||||
## Parameters
|
||||
|
||||
• **code**: `string`
|
||||
|
||||
• **options**: [`ASTLookupArgs`](../type-aliases/ASTLookupArgs.md)
|
||||
|
||||
## Returns
|
||||
|
||||
[`ASTLookupResult`](../type-aliases/ASTLookupResult.md) \| `undefined`
|
||||
|
||||
An object containing the variable's details if found, `undefined` otherwise.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
// Find a variable by name
|
||||
const code = 'const x = 5; let y = "hello";';
|
||||
const a = findVariable(code, { name: 'y' });
|
||||
console.log(a?.result);
|
||||
|
||||
// Find a variable containing specific text
|
||||
const b = findVariable(code, { includes: 'hello' });
|
||||
console.log(b?.result);
|
||||
|
||||
// Find a variable matching a pattern
|
||||
const c = findVariable(code, { regexp: /y\s*=\s*"hello"/ });
|
||||
console.log(c?.result);
|
||||
```
|
||||
|
||||
## Defined in
|
||||
|
||||
[src/utils/Utils.ts:376](https://github.com/LuanRT/YouTube.js/blob/e1650e12979e68b9546bc63989f86b651960a10a/src/utils/Utils.ts#L376)
|
||||
35
docs/api/namespaces/Utils/type-aliases/ASTLookupArgs.md
Normal file
35
docs/api/namespaces/Utils/type-aliases/ASTLookupArgs.md
Normal file
@@ -0,0 +1,35 @@
|
||||
[youtubei.js](../../../README.md) / [Utils](../README.md) / ASTLookupArgs
|
||||
|
||||
# Type Alias: ASTLookupArgs
|
||||
|
||||
> **ASTLookupArgs**: `object`
|
||||
|
||||
## Type declaration
|
||||
|
||||
### ast?
|
||||
|
||||
> `optional` **ast**: `ReturnType`\<*typeof* `Jinter.parseScript`\>
|
||||
|
||||
The abstract syntax tree of the source code.
|
||||
|
||||
### includes?
|
||||
|
||||
> `optional` **includes**: `string`
|
||||
|
||||
A string that must be included in the function's code for it to be considered.
|
||||
|
||||
### name?
|
||||
|
||||
> `optional` **name**: `string`
|
||||
|
||||
The name of the function.
|
||||
|
||||
### regexp?
|
||||
|
||||
> `optional` **regexp**: `RegExp`
|
||||
|
||||
A regular expression that the function's code must match.
|
||||
|
||||
## Defined in
|
||||
|
||||
[src/utils/Utils.ts:268](https://github.com/LuanRT/YouTube.js/blob/e1650e12979e68b9546bc63989f86b651960a10a/src/utils/Utils.ts#L268)
|
||||
31
docs/api/namespaces/Utils/type-aliases/ASTLookupResult.md
Normal file
31
docs/api/namespaces/Utils/type-aliases/ASTLookupResult.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[youtubei.js](../../../README.md) / [Utils](../README.md) / ASTLookupResult
|
||||
|
||||
# Type Alias: ASTLookupResult
|
||||
|
||||
> **ASTLookupResult**: `object`
|
||||
|
||||
## Type declaration
|
||||
|
||||
### end
|
||||
|
||||
> **end**: `number`
|
||||
|
||||
### name
|
||||
|
||||
> **name**: `string`
|
||||
|
||||
### node
|
||||
|
||||
> **node**: `Record`\<`string`, `any`\>
|
||||
|
||||
### result
|
||||
|
||||
> **result**: `string`
|
||||
|
||||
### start
|
||||
|
||||
> **start**: `number`
|
||||
|
||||
## Defined in
|
||||
|
||||
[src/utils/Utils.ts:290](https://github.com/LuanRT/YouTube.js/blob/e1650e12979e68b9546bc63989f86b651960a10a/src/utils/Utils.ts#L290)
|
||||
Reference in New Issue
Block a user