mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: add stronger lint rules
This commit is contained in:
@@ -170,7 +170,6 @@ export const encodeBinaryNode = (
|
||||
}
|
||||
|
||||
const writeString = (str: string) => {
|
||||
// console.log('before write of ', str, ' ', Buffer.from(buffer).toString('hex'))
|
||||
const tokenIndex = TOKEN_MAP[str]
|
||||
if(tokenIndex) {
|
||||
if(typeof tokenIndex.dict === 'number') {
|
||||
@@ -207,7 +206,7 @@ export const encodeBinaryNode = (
|
||||
typeof attrs[k] !== 'undefined' && attrs[k] !== null
|
||||
))
|
||||
|
||||
writeListStart(2 * validAttributes.length + 1 + (typeof content !== 'undefined' && content !== null ? 1 : 0))
|
||||
writeListStart(2 * validAttributes.length + 1 + (typeof content !== 'undefined' ? 1 : 0))
|
||||
writeString(tag)
|
||||
|
||||
for(const key of validAttributes) {
|
||||
@@ -225,11 +224,9 @@ export const encodeBinaryNode = (
|
||||
} else if(Array.isArray(content)) {
|
||||
writeListStart(content.length)
|
||||
for(const item of content) {
|
||||
if(item) {
|
||||
encodeBinaryNode(item, opts, buffer)
|
||||
}
|
||||
encodeBinaryNode(item, opts, buffer)
|
||||
}
|
||||
} else if(typeof content === 'undefined' || content === null) {
|
||||
} else if(typeof content === 'undefined') {
|
||||
// do nothing
|
||||
} else {
|
||||
throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`)
|
||||
|
||||
Reference in New Issue
Block a user