mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
This commit is contained in:
parent
013a52a80d
commit
75cc4483d7
@ -1,6 +1,11 @@
|
|||||||
// A function that takes a file name and a string and returns true if the file name is contained in the string
|
// A function that takes a file name and a string and returns true if the file name is contained in the string
|
||||||
// after removing punctuation and whitespace from both
|
// after removing punctuation and whitespace from both
|
||||||
export const isFileNameInString = (fileName: string, str: string) => {
|
export const isFileNameInString = (fileName: string, str: string) => {
|
||||||
|
// Check if the input string is null or undefined
|
||||||
|
if (!str) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert both to lowercase and remove punctuation and whitespace
|
// Convert both to lowercase and remove punctuation and whitespace
|
||||||
const normalizedFileName = fileName
|
const normalizedFileName = fileName
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
// A function that takes a file name and a string and returns true if the file name is contained in the string
|
// A function that takes a file name and a string and returns true if the file name is contained in the string
|
||||||
// after removing punctuation and whitespace from both
|
// after removing punctuation and whitespace from both
|
||||||
export const isFileNameInString = (fileName: string, str: string) => {
|
export const isFileNameInString = (fileName: string, str: string) => {
|
||||||
|
// Check if the input string is null or undefined
|
||||||
|
if (!str) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Convert both to lowercase and remove punctuation and whitespace
|
// Convert both to lowercase and remove punctuation and whitespace
|
||||||
const normalizedFileName = fileName
|
const normalizedFileName = fileName
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user