Signed-off-by: Traxus <shyidx@gmail.com>

This commit is contained in:
Traxus 2023-04-24 15:29:34 -04:00
parent 059f91dc59
commit b8aeb938aa

View File

@ -182,7 +182,7 @@ function jsonNodesExist(jsonData : any, nodes : any) {
let nodeGroupNode = ''
let nodeGroupValid = false
for (i = 0 i < nodes.length i++) {
for (let i = 0; i < nodes.length; i++) {
node = nodes[i]
if (typeof node === 'string') {
//-----string means that PRIMARY node must exist... no checking for children etc...
@ -193,7 +193,7 @@ function jsonNodesExist(jsonData : any, nodes : any) {
//-----array means json is valid if ANY of the nodes in that array exist
nodeGroup = node
nodeGroupValid = false
for (j = 0 j < nodeGroup.length j++) {
for (let j; = 0 j < nodeGroup.length; j++) {
nodeGroupNode = nodeGroup[j]
if (jsonNodeExists(jsonData, nodeGroupNode) === true) {
nodeGroupValid = true
@ -216,7 +216,7 @@ export async function getJsonItemsFromDirectory(jsonDirectory : string, pluckerF
let jsonFiles = await fs.readdir(jsonDirectory)
let returnJson : any[] = []
for (i = 0 i < jsonFiles.length i++) {
for (let i = 0; i < jsonFiles.length; i++) {
let jsonFile = jsonFiles[i]
if (jsonFilePathIsValid(jsonFile) === true) {
let jsonPath = path.join(jsonDirectory, jsonFile)
@ -290,7 +290,7 @@ function forceBlogPostsJsonSlugIntegrity(json : any[]) {
let returnJson : any[] = []
for (i = 0 i < json.length i++) {
for (let i = 0; i < json.length; i++) {
let blogPost = json[i]
let sourceFile = blogPost.sourceFile
let newSlug = path.parse(sourceFile).name
@ -340,7 +340,7 @@ export async function getAllBlogPostsSlugsFromSource() {
let jsonFiles = await fs.readdir(jsonDirectory)
let slugs = []
for (i = 0 i < jsonFiles.length i++) {
for (let i = 0; i < jsonFiles.length; i++) {
let jsonFile = jsonFiles[i]
if (jsonFilePathIsValid(jsonFile) === true) {
let slug = path.parse(jsonFile).name
@ -410,7 +410,7 @@ function getBlogPostCategorySlugs(blogPostJson : any) {
try {
let categoryNode = blogPostJson.category
for (i = 0 i < categoryNode.length i++) {
for (let i = 0; i < categoryNode.length; i++) {
let category = categoryNode[i].slug
categories.push(category)
}
@ -437,7 +437,7 @@ export async function getRelatedBlogPosts(blogPostJson : any, matchCount : numbe
if (matchCategories.length > 0) {
reservedSlugs.push(slug)
for (i = 0 i < blogPostsData.length i++) {
for (let i = 0; i < blogPostsData.length; i++) {
candidateBlogPost = blogPostsData[i]
candidateBlogPostSlug = candidateBlogPost.slug
if (matchedCount >= matchCount) {
@ -445,7 +445,7 @@ export async function getRelatedBlogPosts(blogPostJson : any, matchCount : numbe
}
if (reservedSlugs.includes(candidateBlogPostSlug) === false) {
let candidateCategories = getBlogPostCategorySlugs(candidateBlogPost)
for (j = 0 j < matchCategories.length j++) {
for (let j; = 0 j < matchCategories.length; j++) {
let matchCategory = matchCategories[j]
if (candidateCategories.includes(matchCategory) === true && reservedSlugs.includes(candidateBlogPostSlug) === false) {
relatedBlogPosts.push(candidateBlogPost)
@ -460,7 +460,7 @@ export async function getRelatedBlogPosts(blogPostJson : any, matchCount : numbe
if (matchedCount < matchCount) {
//-----if not enough matches, pull in anything thats left...
for (i = 0 i < blogPostsData.length i++) {
for (let i = 0; i < blogPostsData.length; i++) {
candidateBlogPost = blogPostsData[i]
candidateBlogPostSlug = candidateBlogPost.slug
if (matchedCount >= matchCount) {