-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input is not a string type (crash on remove
method)
#66
Comments
EXPANDING: I was writing the tests for this and something very interesting happened. const db = create({
schema: {
quote: "string",
author: "string",
},
});
const {id: tomRiddle} = insert(db, {
quote: "Harry Potter, the boy who lived, come to die. Avada kedavra.",
author: "Tom Riddle",
});
remove(db, tomRiddle); The test passes. It successfully deletes the document! const db = create({
schema: {
quote: "string",
author: {
name: "string",
surname: "string",
},
},
});
const {id: tomRiddle} = insert(db, {
quote: "Harry Potter, the boy who lived, come to die. Avada kedavra.",
author: {
name: "Tom",
surname: "Riddle",
},
});
remove(db, tomRiddle); The interesting thing is in export function tokenize(input: string, language: Language = "english") {
const splitRule = splitRegex[language];
const tokens = input.toLowerCase().split(splitRule); // the error occurs in here
return Array.from(new Set(trim(tokens)));
} If the const movieDB = create({
schema: {
title: 'string',
director: 'string',
plot: 'string',
year: 'number',
isFavorite: 'boolean'
}
});
const { id: harryPotter } = insert(movieDB, {
title: 'Harry Potter and the Philosopher\'s Stone',
director: 'Chris Columbus',
plot: 'Harry Potter, an eleven-year-old orphan, discovers that he is a wizard and is invited to study at Hogwarts. Even as he escapes a dreary life and enters a world of magic, he finds trouble awaiting him.',
year: 2001,
isFavorite: false
});
remove(movieDB, harryPotter); typeof input == 'number' const movieDB = create({
schema: {
title: 'string',
director: 'string',
plot: 'string',
isFavorite: 'boolean'
}
});
const { id: harryPotter } = insert(movieDB, {
title: 'Harry Potter and the Philosopher\'s Stone',
director: 'Chris Columbus',
plot: 'Harry Potter, an eleven-year-old orphan, discovers that he is a wizard and is invited to study at Hogwarts. Even as he escapes a dreary life and enters a world of magic, he finds trouble awaiting him.',
isFavorite: false
});
remove(movieDB, harryPotter);
Hope it helps 😄 |
Thank you @thomscoder! I fixed this with 3cb1c75, will be published with the next release. |
Describe the bug
The
remove
method makes Lyrabeta_17
crash.It gives the following error
at
To Reproduce
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: