mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
20 lines
442 B
TypeScript
20 lines
442 B
TypeScript
import { isCallbackUrl } from '../../callbackUrlUtils';
|
|
import isItemId from '../../models/utils/isItemId';
|
|
|
|
export default (query: string) => {
|
|
if (!query) return '';
|
|
|
|
if (isItemId(query) || isCallbackUrl(query)) return query;
|
|
|
|
const output = [];
|
|
const splitted = query.split(' ');
|
|
|
|
for (let i = 0; i < splitted.length; i++) {
|
|
const s = splitted[i].trim();
|
|
if (!s) continue;
|
|
output.push(`${s}*`);
|
|
}
|
|
|
|
return output.join(' ');
|
|
};
|