@thetimes/methode-parser
Advanced tools
Comparing version 7.0.11 to 7.0.12
@@ -19,5 +19,12 @@ "use strict"; | ||
.match(new RegExp(`\\b${substring.toLowerCase()}\\b`)); | ||
const start = regex ? regex.index : -1; | ||
const start = regex && typeof regex.index !== "undefined" ? regex.index : -1; | ||
return start; | ||
}; | ||
exports.sanitiseString = (text) => { | ||
const replacements = [ | ||
["’", "'"], | ||
["`", "'"] | ||
]; | ||
return replacements.reduce((prev, current) => prev.replace(current[0], current[1]), text); | ||
}; | ||
exports.authorToBylineFactory = (authors) => (byline) => { | ||
@@ -30,3 +37,3 @@ const cleanByline = byline.replace(/\s+/g, " "); | ||
.map(({ slug, name }) => { | ||
const startPosition = substringStartPosition(cleanByline, name); | ||
const startPosition = substringStartPosition(exports.sanitiseString(cleanByline), exports.sanitiseString(name)); | ||
return { | ||
@@ -72,2 +79,2 @@ start: startPosition, | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yLXRvLWJ5bGluZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9hdXRob3ItdG8tYnlsaW5lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsTUFBTSxpQkFBaUIsR0FBRyxDQUFDLElBQVksRUFBVSxFQUFFLENBQUMsQ0FBQztJQUNuRCxJQUFJLEVBQUUsUUFBUTtJQUNkLFFBQVEsRUFBRTtRQUNSO1lBQ0UsSUFBSSxFQUFFLE1BQU07WUFDWixVQUFVLEVBQUU7Z0JBQ1YsS0FBSyxFQUFFLElBQUk7YUFDWjtZQUNELFFBQVEsRUFBRSxFQUFFO1NBQ2I7S0FDRjtDQUNGLENBQUMsQ0FBQztBQUVILE1BQU0sc0JBQXNCLEdBQUcsQ0FBQyxJQUFZLEVBQUUsU0FBaUIsRUFBVSxFQUFFO0lBQ3pFLE1BQU0sS0FBSyxHQUFHLElBQUk7U0FDZixXQ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ENBQUM7U0FDSDtJQUNILENBQUMsQ0FBQyxDQUFDO0lBRUgsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDLENBQUMifQ== |
import { Slug } from "./markup"; | ||
export declare const sanitiseString: (text: string) => string; | ||
declare type AuthorNameAndSlug = { | ||
@@ -3,0 +4,0 @@ name: string; |
{ | ||
"name": "@thetimes/methode-parser", | ||
"version": "7.0.11", | ||
"version": "7.0.12", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "lib/types/index.d.ts", |
61800
1055