placementt-core 1.400.1131 → 1.400.1132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/lib/contactName.d.ts +0 -14
- package/lib/contactName.js +0 -27
- package/lib/contactName.js.map +0 -1
- package/lib/contactName.test.d.ts +0 -1
- package/lib/contactName.test.js +0 -25
- package/lib/contactName.test.js.map +0 -1
- package/src/contactName.test.ts +0 -23
- package/src/contactName.ts +0 -23
package/lib/index.d.ts
CHANGED
|
@@ -32,7 +32,6 @@ export * from "./productResolver";
|
|
|
32
32
|
export * from "./pricing";
|
|
33
33
|
export * from "./invoicing";
|
|
34
34
|
export * from "./groups";
|
|
35
|
-
export * from "./contactName";
|
|
36
35
|
export * from "./eventRequestMetrics";
|
|
37
36
|
export * from "./emailSections";
|
|
38
37
|
export * from "./exportTransformers";
|
package/lib/index.js
CHANGED
|
@@ -52,7 +52,6 @@ __exportStar(require("./productResolver"), exports);
|
|
|
52
52
|
__exportStar(require("./pricing"), exports);
|
|
53
53
|
__exportStar(require("./invoicing"), exports);
|
|
54
54
|
__exportStar(require("./groups"), exports);
|
|
55
|
-
__exportStar(require("./contactName"), exports);
|
|
56
55
|
__exportStar(require("./eventRequestMetrics"), exports);
|
|
57
56
|
__exportStar(require("./emailSections"), exports);
|
|
58
57
|
__exportStar(require("./exportTransformers"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,sDAAoC;AACpC,gEAA8C;AAC9C,0DAAwC;AACxC,2DAAyC;AACzC,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,2DAAyC;AAEzC,oDAAkC;AAClC,8CAA4B;AAC5B,kDAAgC;AAChC,kDAAgC;AAChC,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,mDAAiC;AACjC,+CAA6B;AAC7B,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC;AACnC,uDAAqC;AACrC,gDAA8B;AAC9B,4CAA0B;AAC1B,wCAAsB;AACtB,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,oDAAkC;AAClC,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,sDAAoC;AACpC,gEAA8C;AAC9C,0DAAwC;AACxC,2DAAyC;AACzC,kDAAgC;AAChC,uDAAqC;AACrC,4DAA0C;AAC1C,2DAAyC;AAEzC,oDAAkC;AAClC,8CAA4B;AAC5B,kDAAgC;AAChC,kDAAgC;AAChC,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,mDAAiC;AACjC,+CAA6B;AAC7B,oDAAkC;AAClC,iDAA+B;AAC/B,qDAAmC;AACnC,uDAAqC;AACrC,gDAA8B;AAC9B,4CAA0B;AAC1B,wCAAsB;AACtB,kDAAgC;AAChC,6CAA2B;AAC3B,8CAA4B;AAC5B,oDAAkC;AAClC,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,wDAAsC;AACtC,kDAAgC;AAChC,uDAAqC;AACrC,oDAAkC;AAClC,kDAAgC;AAChC,0DAAwC;AACxC,iDAA+B;AAC/B,2DAAyC;AACzC,uDAAqC;AACrC,uDAAqC;AACrC,iDAA+B;AAC/B,8CAA4B;AAC5B,qDAAmC;AACnC,0CAAwB;AACxB,kDAAgC;AAChC,yCAAuB;AACvB,4DAA0C;AAC1C,kDAAgC;AAChC,iDAA+B;AAC/B,2CAAyB;AACzB,4DAA0C;AAC1C,oEAAiD;AACjD,yEAAuD;AACvD,kEAAgD;AAChD,kEAAgD;AAChD,oEAAkD;AAClD,yGAAuF;AACvF,0GAAwF;AACxF,+FAA6E;AAC7E,4DAA0C;AAC1C,oEAAkD;AAClD,iEAA+C;AAC/C,gEAA8C;AAC9C,2EAAyD;AACzD,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,4CAA0B;AAC1B,6DAAuE;AAA9D,2IAAA,OAAO,OAAuB"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -34,7 +34,6 @@ export * from "./productResolver";
|
|
|
34
34
|
export * from "./pricing";
|
|
35
35
|
export * from "./invoicing";
|
|
36
36
|
export * from "./groups";
|
|
37
|
-
export * from "./contactName";
|
|
38
37
|
export * from "./eventRequestMetrics";
|
|
39
38
|
export * from "./emailSections";
|
|
40
39
|
export * from "./exportTransformers";
|
package/lib/contactName.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type SplitContactName = {
|
|
2
|
-
title?: string;
|
|
3
|
-
forename?: string;
|
|
4
|
-
surname?: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Splits a free-text contact name from the lead-gen sheet into title, forename and
|
|
8
|
-
* surname. A leading honorific is taken off as the title, so "Mr Ridd" is surname
|
|
9
|
-
* Ridd with no forename rather than a forename of "Mr".
|
|
10
|
-
*
|
|
11
|
-
* @param {string} name the contact cell, e.g. "Mrs Jo Anne Bloggs" or "Mr Ridd".
|
|
12
|
-
* @return {SplitContactName} the parts; any part may be missing.
|
|
13
|
-
*/
|
|
14
|
-
export declare function splitContactName(name: string | undefined): SplitContactName;
|
package/lib/contactName.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitContactName = splitContactName;
|
|
4
|
-
/** Honorifics that are never a first name. Matched case-insensitively, with or without a full stop. */
|
|
5
|
-
const TITLES = ["mr", "mrs", "ms", "miss", "mx", "dr", "prof", "professor", "sir", "dame", "rev", "revd", "reverend", "fr", "lady", "lord"];
|
|
6
|
-
/**
|
|
7
|
-
* Splits a free-text contact name from the lead-gen sheet into title, forename and
|
|
8
|
-
* surname. A leading honorific is taken off as the title, so "Mr Ridd" is surname
|
|
9
|
-
* Ridd with no forename rather than a forename of "Mr".
|
|
10
|
-
*
|
|
11
|
-
* @param {string} name the contact cell, e.g. "Mrs Jo Anne Bloggs" or "Mr Ridd".
|
|
12
|
-
* @return {SplitContactName} the parts; any part may be missing.
|
|
13
|
-
*/
|
|
14
|
-
function splitContactName(name) {
|
|
15
|
-
const tokens = (name ?? "").trim().split(/\s+/).filter(Boolean);
|
|
16
|
-
let title;
|
|
17
|
-
if (tokens.length && TITLES.includes(tokens[0].replace(/\.$/, "").toLowerCase()))
|
|
18
|
-
title = tokens.shift();
|
|
19
|
-
if (!tokens.length)
|
|
20
|
-
return title ? { title } : {};
|
|
21
|
-
// "Mr Ridd": a title and one word is a surname.
|
|
22
|
-
if (title && tokens.length === 1)
|
|
23
|
-
return { title, surname: tokens[0] };
|
|
24
|
-
const [forename, ...rest] = tokens;
|
|
25
|
-
return { ...(title ? { title } : {}), forename, ...(rest.length ? { surname: rest.join(" ") } : {}) };
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=contactName.js.map
|
package/lib/contactName.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contactName.js","sourceRoot":"","sources":["../src/contactName.ts"],"names":[],"mappings":";;AAaA,4CASC;AAtBD,uGAAuG;AACvG,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,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 = require("./contactName");
|
|
4
|
-
describe("splitContactName", () => {
|
|
5
|
-
it("treats a title and one word as a surname", () => {
|
|
6
|
-
expect((0, contactName_1.splitContactName)("Mr Ridd")).toEqual({ title: "Mr", surname: "Ridd" });
|
|
7
|
-
expect((0, contactName_1.splitContactName)("dr. Patel")).toEqual({ title: "dr.", surname: "Patel" });
|
|
8
|
-
});
|
|
9
|
-
it("strips the title from a full name", () => {
|
|
10
|
-
expect((0, contactName_1.splitContactName)("Mrs Jo Anne Bloggs")).toEqual({ title: "Mrs", forename: "Jo", surname: "Anne Bloggs" });
|
|
11
|
-
});
|
|
12
|
-
it("splits a name with no title", () => {
|
|
13
|
-
expect((0, contactName_1.splitContactName)("Rebecca Hargreaves")).toEqual({ forename: "Rebecca", surname: "Hargreaves" });
|
|
14
|
-
expect((0, contactName_1.splitContactName)("Rebecca")).toEqual({ forename: "Rebecca" });
|
|
15
|
-
});
|
|
16
|
-
it("does not mistake a name that starts like a title", () => {
|
|
17
|
-
expect((0, contactName_1.splitContactName)("Misty Rowe")).toEqual({ forename: "Misty", surname: "Rowe" });
|
|
18
|
-
});
|
|
19
|
-
it("handles blanks", () => {
|
|
20
|
-
expect((0, contactName_1.splitContactName)("")).toEqual({});
|
|
21
|
-
expect((0, contactName_1.splitContactName)(undefined)).toEqual({});
|
|
22
|
-
expect((0, contactName_1.splitContactName)("Mr")).toEqual({ title: "Mr" });
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=contactName.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contactName.test.js","sourceRoot":"","sources":["../src/contactName.test.ts"],"names":[],"mappings":";;AAAA,+CAA+C;AAE/C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,IAAA,8BAAgB,EAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,KAAK,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AM,CAAC,IAAA,8BAAgB,EAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/src/contactName.test.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {splitContactName} from "./contactName";
|
|
2
|
-
|
|
3
|
-
describe("splitContactName", () => {
|
|
4
|
-
it("treats a title and one word as a surname", () => {
|
|
5
|
-
expect(splitContactName("Mr Ridd")).toEqual({title: "Mr", surname: "Ridd"});
|
|
6
|
-
expect(splitContactName("dr. Patel")).toEqual({title: "dr.", surname: "Patel"});
|
|
7
|
-
});
|
|
8
|
-
it("strips the title from a full name", () => {
|
|
9
|
-
expect(splitContactName("Mrs Jo Anne Bloggs")).toEqual({title: "Mrs", forename: "Jo", surname: "Anne Bloggs"});
|
|
10
|
-
});
|
|
11
|
-
it("splits a name with no title", () => {
|
|
12
|
-
expect(splitContactName("Rebecca Hargreaves")).toEqual({forename: "Rebecca", surname: "Hargreaves"});
|
|
13
|
-
expect(splitContactName("Rebecca")).toEqual({forename: "Rebecca"});
|
|
14
|
-
});
|
|
15
|
-
it("does not mistake a name that starts like a title", () => {
|
|
16
|
-
expect(splitContactName("Misty Rowe")).toEqual({forename: "Misty", surname: "Rowe"});
|
|
17
|
-
});
|
|
18
|
-
it("handles blanks", () => {
|
|
19
|
-
expect(splitContactName("")).toEqual({});
|
|
20
|
-
expect(splitContactName(undefined)).toEqual({});
|
|
21
|
-
expect(splitContactName("Mr")).toEqual({title: "Mr"});
|
|
22
|
-
});
|
|
23
|
-
});
|
package/src/contactName.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** Honorifics that are never a first name. Matched case-insensitively, with or without a full stop. */
|
|
2
|
-
const TITLES = ["mr", "mrs", "ms", "miss", "mx", "dr", "prof", "professor", "sir", "dame", "rev", "revd", "reverend", "fr", "lady", "lord"];
|
|
3
|
-
|
|
4
|
-
export type SplitContactName = {title?: string, forename?: string, surname?: string};
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Splits a free-text contact name from the lead-gen sheet into title, forename and
|
|
8
|
-
* surname. A leading honorific is taken off as the title, so "Mr Ridd" is surname
|
|
9
|
-
* Ridd with no forename rather than a forename of "Mr".
|
|
10
|
-
*
|
|
11
|
-
* @param {string} name the contact cell, e.g. "Mrs Jo Anne Bloggs" or "Mr Ridd".
|
|
12
|
-
* @return {SplitContactName} the parts; any part may be missing.
|
|
13
|
-
*/
|
|
14
|
-
export function splitContactName(name: string | undefined): SplitContactName {
|
|
15
|
-
const tokens = (name ?? "").trim().split(/\s+/).filter(Boolean);
|
|
16
|
-
let title: string | undefined;
|
|
17
|
-
if (tokens.length && TITLES.includes(tokens[0].replace(/\.$/, "").toLowerCase())) title = tokens.shift();
|
|
18
|
-
if (!tokens.length) return title ? {title} : {};
|
|
19
|
-
// "Mr Ridd": a title and one word is a surname.
|
|
20
|
-
if (title && tokens.length === 1) return {title, surname: tokens[0]};
|
|
21
|
-
const [forename, ...rest] = tokens;
|
|
22
|
-
return {...(title ? {title} : {}), forename, ...(rest.length ? {surname: rest.join(" ")} : {})};
|
|
23
|
-
}
|