@serenity-js/core 2.32.4 → 3.0.0-rc.3
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/CHANGELOG.md +76 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/io/ErrorSerialiser.js +4 -1
- package/lib/io/ErrorSerialiser.js.map +1 -1
- package/lib/io/asyncMap.d.ts +8 -0
- package/lib/io/asyncMap.js +18 -0
- package/lib/io/asyncMap.js.map +1 -0
- package/lib/io/format.d.ts +37 -0
- package/lib/io/format.js +49 -0
- package/lib/io/format.js.map +1 -0
- package/lib/io/formatted.d.ts +5 -1
- package/lib/io/formatted.js +6 -13
- package/lib/io/formatted.js.map +1 -1
- package/lib/io/index.d.ts +2 -1
- package/lib/io/index.js +2 -1
- package/lib/io/index.js.map +1 -1
- package/lib/io/inspected.d.ts +9 -1
- package/lib/io/inspected.js +50 -14
- package/lib/io/inspected.js.map +1 -1
- package/lib/model/Timestamp.d.ts +4 -2
- package/lib/model/Timestamp.js +8 -2
- package/lib/model/Timestamp.js.map +1 -1
- package/lib/screenplay/Question.d.ts +6 -83
- package/lib/screenplay/Question.js +14 -98
- package/lib/screenplay/Question.js.map +1 -1
- package/lib/screenplay/actor/Actor.js +2 -2
- package/lib/screenplay/actor/Actor.js.map +1 -1
- package/lib/screenplay/index.d.ts +1 -1
- package/lib/screenplay/index.js +1 -1
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/model/Adapter.d.ts +8 -0
- package/lib/{io/collections/reducible.js → screenplay/model/Adapter.js} +1 -1
- package/lib/screenplay/model/Adapter.js.map +1 -0
- package/lib/screenplay/model/createAdapter.d.ts +3 -0
- package/lib/screenplay/model/createAdapter.js +112 -0
- package/lib/screenplay/model/createAdapter.js.map +1 -0
- package/lib/screenplay/model/index.d.ts +2 -0
- package/lib/screenplay/{tasks → model}/index.js +2 -1
- package/lib/screenplay/model/index.js.map +1 -0
- package/lib/screenplay/questions/Expectation.d.ts +11 -0
- package/lib/screenplay/questions/Expectation.js +18 -1
- package/lib/screenplay/questions/Expectation.js.map +1 -1
- package/lib/screenplay/questions/List.d.ts +22 -191
- package/lib/screenplay/questions/List.js +162 -208
- package/lib/screenplay/questions/List.js.map +1 -1
- package/lib/screenplay/questions/Note.d.ts +10 -0
- package/lib/screenplay/questions/Note.js +17 -1
- package/lib/screenplay/questions/Note.js.map +1 -1
- package/lib/screenplay/questions/index.d.ts +0 -3
- package/lib/screenplay/questions/index.js +0 -5
- package/lib/screenplay/questions/index.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +2 -1
- package/src/io/ErrorSerialiser.ts +5 -1
- package/src/io/asyncMap.ts +18 -0
- package/src/io/format.ts +46 -0
- package/src/io/formatted.ts +7 -15
- package/src/io/index.ts +2 -1
- package/src/io/inspected.ts +66 -14
- package/src/model/Timestamp.ts +10 -2
- package/src/screenplay/Question.ts +21 -119
- package/src/screenplay/actor/Actor.ts +2 -2
- package/src/screenplay/index.ts +1 -1
- package/src/screenplay/model/Adapter.ts +14 -0
- package/src/screenplay/model/createAdapter.ts +142 -0
- package/src/screenplay/model/index.ts +2 -0
- package/src/screenplay/questions/Expectation.ts +20 -1
- package/src/screenplay/questions/List.ts +228 -232
- package/src/screenplay/questions/Note.ts +21 -1
- package/src/screenplay/questions/index.ts +0 -3
- package/lib/io/collections/index.d.ts +0 -2
- package/lib/io/collections/index.js +0 -15
- package/lib/io/collections/index.js.map +0 -1
- package/lib/io/collections/mappable.d.ts +0 -52
- package/lib/io/collections/mappable.js +0 -28
- package/lib/io/collections/mappable.js.map +0 -1
- package/lib/io/collections/reducible.d.ts +0 -16
- package/lib/io/collections/reducible.js.map +0 -1
- package/lib/screenplay/questions/Property.d.ts +0 -91
- package/lib/screenplay/questions/Property.js +0 -99
- package/lib/screenplay/questions/Property.js.map +0 -1
- package/lib/screenplay/questions/Transform.d.ts +0 -31
- package/lib/screenplay/questions/Transform.js +0 -46
- package/lib/screenplay/questions/Transform.js.map +0 -1
- package/lib/screenplay/questions/lists/ArrayListAdapter.d.ts +0 -88
- package/lib/screenplay/questions/lists/ArrayListAdapter.js +0 -152
- package/lib/screenplay/questions/lists/ArrayListAdapter.js.map +0 -1
- package/lib/screenplay/questions/lists/ListAdapter.d.ts +0 -20
- package/lib/screenplay/questions/lists/ListAdapter.js +0 -3
- package/lib/screenplay/questions/lists/ListAdapter.js.map +0 -1
- package/lib/screenplay/questions/lists/index.d.ts +0 -2
- package/lib/screenplay/questions/lists/index.js +0 -15
- package/lib/screenplay/questions/lists/index.js.map +0 -1
- package/lib/screenplay/questions/mappings/AnswerMappingFunction.d.ts +0 -11
- package/lib/screenplay/questions/mappings/AnswerMappingFunction.js +0 -3
- package/lib/screenplay/questions/mappings/AnswerMappingFunction.js.map +0 -1
- package/lib/screenplay/questions/mappings/index.d.ts +0 -2
- package/lib/screenplay/questions/mappings/index.js +0 -15
- package/lib/screenplay/questions/mappings/index.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/append.d.ts +0 -14
- package/lib/screenplay/questions/mappings/string/append.js +0 -25
- package/lib/screenplay/questions/mappings/string/append.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/index.d.ts +0 -11
- package/lib/screenplay/questions/mappings/string/index.js +0 -24
- package/lib/screenplay/questions/mappings/string/index.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/normalize.d.ts +0 -20
- package/lib/screenplay/questions/mappings/string/normalize.js +0 -30
- package/lib/screenplay/questions/mappings/string/normalize.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/replace.d.ts +0 -17
- package/lib/screenplay/questions/mappings/string/replace.js +0 -30
- package/lib/screenplay/questions/mappings/string/replace.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/slice.d.ts +0 -28
- package/lib/screenplay/questions/mappings/string/slice.js +0 -47
- package/lib/screenplay/questions/mappings/string/slice.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/split.d.ts +0 -19
- package/lib/screenplay/questions/mappings/string/split.js +0 -36
- package/lib/screenplay/questions/mappings/string/split.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/toLocaleLowerCase.d.ts +0 -17
- package/lib/screenplay/questions/mappings/string/toLocaleLowerCase.js +0 -28
- package/lib/screenplay/questions/mappings/string/toLocaleLowerCase.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/toLocaleUpperCase.d.ts +0 -17
- package/lib/screenplay/questions/mappings/string/toLocaleUpperCase.js +0 -29
- package/lib/screenplay/questions/mappings/string/toLocaleUpperCase.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/toLowerCase.d.ts +0 -10
- package/lib/screenplay/questions/mappings/string/toLowerCase.js +0 -19
- package/lib/screenplay/questions/mappings/string/toLowerCase.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/toNumber.d.ts +0 -10
- package/lib/screenplay/questions/mappings/string/toNumber.js +0 -18
- package/lib/screenplay/questions/mappings/string/toNumber.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/toUpperCase.d.ts +0 -10
- package/lib/screenplay/questions/mappings/string/toUpperCase.js +0 -19
- package/lib/screenplay/questions/mappings/string/toUpperCase.js.map +0 -1
- package/lib/screenplay/questions/mappings/string/trim.d.ts +0 -12
- package/lib/screenplay/questions/mappings/string/trim.js +0 -21
- package/lib/screenplay/questions/mappings/string/trim.js.map +0 -1
- package/lib/screenplay/questions/proxies/PropertyPathKey.d.ts +0 -4
- package/lib/screenplay/questions/proxies/PropertyPathKey.js +0 -3
- package/lib/screenplay/questions/proxies/PropertyPathKey.js.map +0 -1
- package/lib/screenplay/questions/proxies/createMetaQuestionProxy.d.ts +0 -14
- package/lib/screenplay/questions/proxies/createMetaQuestionProxy.js +0 -35
- package/lib/screenplay/questions/proxies/createMetaQuestionProxy.js.map +0 -1
- package/lib/screenplay/questions/proxies/createQuestionProxy.d.ts +0 -13
- package/lib/screenplay/questions/proxies/createQuestionProxy.js +0 -34
- package/lib/screenplay/questions/proxies/createQuestionProxy.js.map +0 -1
- package/lib/screenplay/questions/proxies/describePath.d.ts +0 -5
- package/lib/screenplay/questions/proxies/describePath.js +0 -19
- package/lib/screenplay/questions/proxies/describePath.js.map +0 -1
- package/lib/screenplay/questions/proxies/index.d.ts +0 -2
- package/lib/screenplay/questions/proxies/index.js +0 -15
- package/lib/screenplay/questions/proxies/index.js.map +0 -1
- package/lib/screenplay/questions/proxies/key.d.ts +0 -8
- package/lib/screenplay/questions/proxies/key.js +0 -16
- package/lib/screenplay/questions/proxies/key.js.map +0 -1
- package/lib/screenplay/tasks/Loop.d.ts +0 -198
- package/lib/screenplay/tasks/Loop.js +0 -222
- package/lib/screenplay/tasks/Loop.js.map +0 -1
- package/lib/screenplay/tasks/index.d.ts +0 -1
- package/lib/screenplay/tasks/index.js.map +0 -1
- package/src/io/collections/index.ts +0 -2
- package/src/io/collections/mappable.ts +0 -60
- package/src/io/collections/reducible.ts +0 -16
- package/src/screenplay/questions/Property.ts +0 -98
- package/src/screenplay/questions/Transform.ts +0 -51
- package/src/screenplay/questions/lists/ArrayListAdapter.ts +0 -186
- package/src/screenplay/questions/lists/ListAdapter.ts +0 -33
- package/src/screenplay/questions/lists/index.ts +0 -2
- package/src/screenplay/questions/mappings/AnswerMappingFunction.ts +0 -13
- package/src/screenplay/questions/mappings/index.ts +0 -2
- package/src/screenplay/questions/mappings/string/append.ts +0 -28
- package/src/screenplay/questions/mappings/string/index.ts +0 -11
- package/src/screenplay/questions/mappings/string/normalize.ts +0 -33
- package/src/screenplay/questions/mappings/string/replace.ts +0 -34
- package/src/screenplay/questions/mappings/string/slice.ts +0 -53
- package/src/screenplay/questions/mappings/string/split.ts +0 -38
- package/src/screenplay/questions/mappings/string/toLocaleLowerCase.ts +0 -31
- package/src/screenplay/questions/mappings/string/toLocaleUpperCase.ts +0 -30
- package/src/screenplay/questions/mappings/string/toLowerCase.ts +0 -20
- package/src/screenplay/questions/mappings/string/toNumber.ts +0 -19
- package/src/screenplay/questions/mappings/string/toUpperCase.ts +0 -20
- package/src/screenplay/questions/mappings/string/trim.ts +0 -22
- package/src/screenplay/questions/proxies/PropertyPathKey.ts +0 -4
- package/src/screenplay/questions/proxies/createMetaQuestionProxy.ts +0 -51
- package/src/screenplay/questions/proxies/createQuestionProxy.ts +0 -49
- package/src/screenplay/questions/proxies/describePath.ts +0 -23
- package/src/screenplay/questions/proxies/index.ts +0 -2
- package/src/screenplay/questions/proxies/key.ts +0 -14
- package/src/screenplay/tasks/Loop.ts +0 -240
- package/src/screenplay/tasks/index.ts +0 -1
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayListAdapter = void 0;
|
|
4
|
-
const tiny_types_1 = require("tiny-types");
|
|
5
|
-
const io_1 = require("../../../io");
|
|
6
|
-
const Question_1 = require("../../Question");
|
|
7
|
-
const expectations_1 = require("../expectations");
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Adapts an {@link Array} so that it can be used with {@link List}
|
|
11
|
-
*
|
|
12
|
-
* @implements {ListAdapter}
|
|
13
|
-
*/
|
|
14
|
-
class ArrayListAdapter {
|
|
15
|
-
/**
|
|
16
|
-
* @param {Answerable<Item_Type[]>} array
|
|
17
|
-
*/
|
|
18
|
-
constructor(array) {
|
|
19
|
-
this.array = array;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @desc
|
|
23
|
-
* Returns the number of items the underlying {@link Array} contains,
|
|
24
|
-
* left after applying any filters.
|
|
25
|
-
*
|
|
26
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
27
|
-
* @returns {Promise<number>}
|
|
28
|
-
*/
|
|
29
|
-
count(actor) {
|
|
30
|
-
return this.arrayAs(actor)
|
|
31
|
-
.then(items => items.length);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @desc
|
|
35
|
-
* Returns the underlying {@link Array},
|
|
36
|
-
* with any filters applied.
|
|
37
|
-
*
|
|
38
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
39
|
-
* @returns {Promise<number>}
|
|
40
|
-
*/
|
|
41
|
-
items(actor) {
|
|
42
|
-
return this.arrayAs(actor);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @desc
|
|
46
|
-
* Returns the first of items the underlying {@link Array} contains,
|
|
47
|
-
* left after applying any filters.
|
|
48
|
-
*
|
|
49
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
50
|
-
* @returns {Promise<Item_Type>}
|
|
51
|
-
*/
|
|
52
|
-
first(actor) {
|
|
53
|
-
return this.arrayAs(actor)
|
|
54
|
-
.then(items => this.getItemAt(items, 0));
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @desc
|
|
58
|
-
* Returns the nth of items the underlying {@link Array} contains,
|
|
59
|
-
* left after applying any filters.
|
|
60
|
-
*
|
|
61
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
62
|
-
*
|
|
63
|
-
* @param {number} index
|
|
64
|
-
* Zero-based index of the item to return
|
|
65
|
-
*
|
|
66
|
-
* @returns {Promise<Item_Type>}
|
|
67
|
-
*/
|
|
68
|
-
get(actor, index) {
|
|
69
|
-
return this.arrayAs(actor)
|
|
70
|
-
.then(items => this.getItemAt(items, index));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @desc
|
|
74
|
-
* Returns the last of items the underlying {@link Array} contains,
|
|
75
|
-
* left after applying any filters.
|
|
76
|
-
*
|
|
77
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
78
|
-
* @returns {Promise<Item_Type>}
|
|
79
|
-
*/
|
|
80
|
-
last(actor) {
|
|
81
|
-
return this.arrayAs(actor)
|
|
82
|
-
.then(items => this.getItemAt(items, items.length - 1));
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @desc
|
|
86
|
-
* Filters the underlying {@link Array} so that the result contains only those items that meet the {@link Expectation}
|
|
87
|
-
*
|
|
88
|
-
* @param {MetaQuestion<Item_Type, Promise<Answer_Type> | Answer_Type>} question
|
|
89
|
-
* @param {Expectation<any, Answer_Type>} expectation
|
|
90
|
-
*
|
|
91
|
-
* @returns {ListAdapter<Item_Type, Item_Type[], Promise<Item_Type>, Promise<Item_Type[]>>}
|
|
92
|
-
*
|
|
93
|
-
* @see {MetaQuestion}
|
|
94
|
-
*/
|
|
95
|
-
withFilter(question, expectation) {
|
|
96
|
-
return new ArrayListAdapter(new ArrayListFilter(this.array, question, expectation));
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* @desc
|
|
100
|
-
* Returns a human-readable description of the underlying {@link Array}.
|
|
101
|
-
*
|
|
102
|
-
* @returns {string}
|
|
103
|
-
*/
|
|
104
|
-
toString() {
|
|
105
|
-
return (0, io_1.formatted) `${this.array}`;
|
|
106
|
-
}
|
|
107
|
-
arrayAs(actor) {
|
|
108
|
-
return actor.answer(this.array)
|
|
109
|
-
.then(array => (0, tiny_types_1.ensure)('ArrayListAdapter constructor parameter', array, (0, tiny_types_1.isArray)()));
|
|
110
|
-
}
|
|
111
|
-
getItemAt(items, index) {
|
|
112
|
-
(0, tiny_types_1.ensure)('index', index, (0, tiny_types_1.isNumber)());
|
|
113
|
-
const collectionDescription = this.toString();
|
|
114
|
-
const itemsDescription = (0, io_1.formatted) `${items}`;
|
|
115
|
-
const description = collectionDescription !== itemsDescription
|
|
116
|
-
? `${collectionDescription} ${itemsDescription}`
|
|
117
|
-
: itemsDescription;
|
|
118
|
-
if (items.length === 0) {
|
|
119
|
-
throw new Error(`${description} is empty`);
|
|
120
|
-
}
|
|
121
|
-
if (index in items) {
|
|
122
|
-
return items[index];
|
|
123
|
-
}
|
|
124
|
-
throw new Error(`${description} has no item at index ${index}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
exports.ArrayListAdapter = ArrayListAdapter;
|
|
128
|
-
/**
|
|
129
|
-
* @package
|
|
130
|
-
*/
|
|
131
|
-
class ArrayListFilter extends Question_1.Question {
|
|
132
|
-
constructor(collection, question, expectation) {
|
|
133
|
-
super([
|
|
134
|
-
(0, io_1.formatted) `${collection}`,
|
|
135
|
-
collection instanceof ArrayListFilter ? 'and' : 'where',
|
|
136
|
-
(0, io_1.formatted) `${question} does ${expectation}`
|
|
137
|
-
].join(' '));
|
|
138
|
-
this.collection = collection;
|
|
139
|
-
this.question = question;
|
|
140
|
-
this.expectation = expectation;
|
|
141
|
-
}
|
|
142
|
-
answeredBy(actor) {
|
|
143
|
-
return actor.answer(this.collection)
|
|
144
|
-
.then(array => (0, tiny_types_1.ensure)('ArrayListAdapter constructor parameter', array, (0, tiny_types_1.isArray)())) // todo: extract to avoid duplication?
|
|
145
|
-
.then(array => Promise.all(array.map(item => Promise.resolve(this.question.of(item).answeredBy(actor))
|
|
146
|
-
.then(answer => this.expectation.answeredBy(actor)(answer))
|
|
147
|
-
.then(outcome => ({ item, outcome })))))
|
|
148
|
-
.then(results => results.filter(result => result.outcome instanceof expectations_1.ExpectationMet)
|
|
149
|
-
.map(result => result.item));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=ArrayListAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayListAdapter.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/lists/ArrayListAdapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AnswersQuestions, UsesAbilities } from '../../actor';
|
|
2
|
-
import { Expectation } from '../Expectation';
|
|
3
|
-
import { MetaQuestion } from '../MetaQuestion';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Adapts various types of collections so that they can be used with {@link List}.
|
|
7
|
-
*
|
|
8
|
-
* You probably won't need to implement this interface, unless you're extending Serenity/JS.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link List}
|
|
11
|
-
*/
|
|
12
|
-
export interface ListAdapter<Item_Type, Collection_Type, Item_Return_Type = Item_Type, Collection_Return_Type = Collection_Type> {
|
|
13
|
-
count(actor: AnswersQuestions & UsesAbilities): Promise<number>;
|
|
14
|
-
first(actor: AnswersQuestions & UsesAbilities): Item_Return_Type;
|
|
15
|
-
last(actor: AnswersQuestions & UsesAbilities): Item_Return_Type;
|
|
16
|
-
get(actor: AnswersQuestions & UsesAbilities, index: number): Item_Return_Type;
|
|
17
|
-
items(actor: AnswersQuestions & UsesAbilities): Collection_Return_Type;
|
|
18
|
-
withFilter<Answer_Type>(question: MetaQuestion<Item_Type, Promise<Answer_Type> | Answer_Type>, expectation: Expectation<any, Answer_Type>): ListAdapter<Item_Type, Collection_Type, Item_Return_Type, Collection_Return_Type>;
|
|
19
|
-
toString(): string;
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListAdapter.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/lists/ListAdapter.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./ArrayListAdapter"), exports);
|
|
14
|
-
__exportStar(require("./ListAdapter"), exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/lists/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,gDAA8B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MappingFunction } from '../../../io/collections';
|
|
2
|
-
import { AnswersQuestions } from '../../actor';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* A mapping function converting one type into another.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*
|
|
9
|
-
* @typedef {function(actor: AnswersQuestions) => MappingFunction<V,O>} AnswerMappingFunction<V, O>
|
|
10
|
-
*/
|
|
11
|
-
export declare type AnswerMappingFunction<V, O> = (actor: AnswersQuestions) => MappingFunction<V, Promise<O> | O>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnswerMappingFunction.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/mappings/AnswerMappingFunction.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./AnswerMappingFunction"), exports);
|
|
14
|
-
__exportStar(require("./string"), exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/mappings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAwC;AACxC,2CAAyB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '../../../Answerable';
|
|
2
|
-
import { AnswerMappingFunction } from '../AnswerMappingFunction';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Appends the values to the end of the original string and returns a new string.
|
|
6
|
-
*
|
|
7
|
-
* @param {...Array<Answerable<string>>} values
|
|
8
|
-
* The values to append to the end of the string.
|
|
9
|
-
*
|
|
10
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
11
|
-
*
|
|
12
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat
|
|
13
|
-
*/
|
|
14
|
-
export declare function append(...values: Array<Answerable<string>>): AnswerMappingFunction<string, string>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.append = void 0;
|
|
4
|
-
/* eslint-disable unicorn/consistent-function-scoping */
|
|
5
|
-
const tiny_types_1 = require("tiny-types");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Appends the values to the end of the original string and returns a new string.
|
|
9
|
-
*
|
|
10
|
-
* @param {...Array<Answerable<string>>} values
|
|
11
|
-
* The values to append to the end of the string.
|
|
12
|
-
*
|
|
13
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
14
|
-
*
|
|
15
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat
|
|
16
|
-
*/
|
|
17
|
-
function append(...values) {
|
|
18
|
-
return (actor) => (originalAnswer) => {
|
|
19
|
-
(0, tiny_types_1.ensure)('The value to be mapped', originalAnswer, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
|
|
20
|
-
return Promise.all(values.map(value => actor.answer(value)))
|
|
21
|
-
.then(answers => originalAnswer.concat(...answers));
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.append = append;
|
|
25
|
-
//# sourceMappingURL=append.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"append.js","sourceRoot":"","sources":["../../../../../src/screenplay/questions/mappings/string/append.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAyD;AAMzD;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,GAAG,MAAiC;IACvD,OAAO,CAAC,KAAuB,EAAE,EAAE,CAC/B,CAAC,cAAsB,EAAE,EAAE;QAEvB,IAAA,mBAAM,EAAC,wBAAwB,EAAE,cAAc,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,CAAC,CAAC;QAE1E,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAA;IAC3D,CAAC,CAAA;AACT,CAAC;AATD,wBASC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './append';
|
|
2
|
-
export * from './normalize';
|
|
3
|
-
export * from './replace';
|
|
4
|
-
export * from './slice';
|
|
5
|
-
export * from './split';
|
|
6
|
-
export * from './toLocaleLowerCase';
|
|
7
|
-
export * from './toLocaleUpperCase';
|
|
8
|
-
export * from './toLowerCase';
|
|
9
|
-
export * from './toNumber';
|
|
10
|
-
export * from './toUpperCase';
|
|
11
|
-
export * from './trim';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./append"), exports);
|
|
14
|
-
__exportStar(require("./normalize"), exports);
|
|
15
|
-
__exportStar(require("./replace"), exports);
|
|
16
|
-
__exportStar(require("./slice"), exports);
|
|
17
|
-
__exportStar(require("./split"), exports);
|
|
18
|
-
__exportStar(require("./toLocaleLowerCase"), exports);
|
|
19
|
-
__exportStar(require("./toLocaleUpperCase"), exports);
|
|
20
|
-
__exportStar(require("./toLowerCase"), exports);
|
|
21
|
-
__exportStar(require("./toNumber"), exports);
|
|
22
|
-
__exportStar(require("./toUpperCase"), exports);
|
|
23
|
-
__exportStar(require("./trim"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/screenplay/questions/mappings/string/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,sDAAoC;AACpC,sDAAoC;AACpC,gDAA8B;AAC9B,6CAA2B;AAC3B,gDAA8B;AAC9B,yCAAuB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '../../../Answerable';
|
|
2
|
-
import { AnswerMappingFunction } from '../AnswerMappingFunction';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Returns the String value result of normalizing the string into the normalization form
|
|
6
|
-
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
|
7
|
-
*
|
|
8
|
-
* @param {Answerable<string>} [form]
|
|
9
|
-
* One of "NFC", "NFD", "NFKC", or "NFKD", specifying the Unicode Normalization Form. If omitted or undefined, "NFC" is used.
|
|
10
|
-
* These values have the following meanings:
|
|
11
|
-
* "NFC" - Canonical Decomposition, followed by Canonical Composition.
|
|
12
|
-
* "NFD" - Canonical Decomposition.
|
|
13
|
-
* "NFKC" - Compatibility Decomposition, followed by Canonical Composition.
|
|
14
|
-
* "NFKD" - Compatibility Decomposition.
|
|
15
|
-
*
|
|
16
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
17
|
-
*
|
|
18
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
|
|
19
|
-
*/
|
|
20
|
-
export declare function normalize(form?: Answerable<string>): AnswerMappingFunction<string, string>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalize = void 0;
|
|
4
|
-
/* eslint-disable unicorn/consistent-function-scoping */
|
|
5
|
-
const tiny_types_1 = require("tiny-types");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Returns the String value result of normalizing the string into the normalization form
|
|
9
|
-
* named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
|
|
10
|
-
*
|
|
11
|
-
* @param {Answerable<string>} [form]
|
|
12
|
-
* One of "NFC", "NFD", "NFKC", or "NFKD", specifying the Unicode Normalization Form. If omitted or undefined, "NFC" is used.
|
|
13
|
-
* These values have the following meanings:
|
|
14
|
-
* "NFC" - Canonical Decomposition, followed by Canonical Composition.
|
|
15
|
-
* "NFD" - Canonical Decomposition.
|
|
16
|
-
* "NFKC" - Compatibility Decomposition, followed by Canonical Composition.
|
|
17
|
-
* "NFKD" - Compatibility Decomposition.
|
|
18
|
-
*
|
|
19
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
20
|
-
*
|
|
21
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
|
|
22
|
-
*/
|
|
23
|
-
function normalize(form) {
|
|
24
|
-
return (actor) => (value) => {
|
|
25
|
-
(0, tiny_types_1.ensure)('The value to be mapped', value, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
|
|
26
|
-
return actor.answer(form).then(answer => value.normalize(answer));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.normalize = normalize;
|
|
30
|
-
//# sourceMappingURL=normalize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../../../src/screenplay/questions/mappings/string/normalize.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAyD;AAMzD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,SAAS,CAAC,IAAyB;IAC/C,OAAO,CAAC,KAAuB,EAAE,EAAE,CAC/B,CAAC,KAAa,EAAE,EAAE;QAEd,IAAA,mBAAM,EAAC,wBAAwB,EAAE,KAAK,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,CAAC,CAAA;QAEhE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,CAAC,CAAA;AACT,CAAC;AARD,8BAQC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '../../../Answerable';
|
|
2
|
-
import { AnswerMappingFunction } from '../AnswerMappingFunction';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Returns a new string with some or all matches of a pattern replaced by a replacement.
|
|
6
|
-
* The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match.
|
|
7
|
-
* If pattern is a string, only the first occurrence will be replaced.
|
|
8
|
-
*
|
|
9
|
-
* @param {Answerable<string | RegExp>} pattern
|
|
10
|
-
*
|
|
11
|
-
* @param {Answerable<string|function>} replacement
|
|
12
|
-
*
|
|
13
|
-
* @returns {MappingFunction<string, string>}
|
|
14
|
-
*
|
|
15
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
|
|
16
|
-
*/
|
|
17
|
-
export declare function replace(pattern: Answerable<RegExp | string>, replacement: Answerable<string | ((substring: string, ...args: any[]) => string)>): AnswerMappingFunction<string, string>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replace = void 0;
|
|
4
|
-
/* eslint-disable unicorn/consistent-function-scoping */
|
|
5
|
-
const tiny_types_1 = require("tiny-types");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Returns a new string with some or all matches of a pattern replaced by a replacement.
|
|
9
|
-
* The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match.
|
|
10
|
-
* If pattern is a string, only the first occurrence will be replaced.
|
|
11
|
-
*
|
|
12
|
-
* @param {Answerable<string | RegExp>} pattern
|
|
13
|
-
*
|
|
14
|
-
* @param {Answerable<string|function>} replacement
|
|
15
|
-
*
|
|
16
|
-
* @returns {MappingFunction<string, string>}
|
|
17
|
-
*
|
|
18
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
|
|
19
|
-
*/
|
|
20
|
-
function replace(pattern, replacement) {
|
|
21
|
-
return (actor) => (value) => {
|
|
22
|
-
(0, tiny_types_1.ensure)('The value to be mapped', value, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
|
|
23
|
-
return Promise.all([
|
|
24
|
-
actor.answer(pattern),
|
|
25
|
-
actor.answer(replacement),
|
|
26
|
-
]).then(([p, r]) => value.replace(p, r));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.replace = replace;
|
|
30
|
-
//# sourceMappingURL=replace.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../../../../src/screenplay/questions/mappings/string/replace.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAyD;AAMzD;;;;;;;;;;;;;GAaG;AACH,SAAgB,OAAO,CAAC,OAAoC,EAAE,WAAiF;IAC3I,OAAO,CAAC,KAAuB,EAAE,EAAE,CAC/B,CAAC,KAAa,EAAE,EAAE;QACd,IAAA,mBAAM,EAAC,wBAAwB,EAAE,KAAK,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,CAAC,CAAA;QAEhE,OAAO,OAAO,CAAC,GAAG,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;YACrB,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;SAC5B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CACf,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAQ,CAAC,CAC7B,CAAC;IACN,CAAC,CAAA;AACT,CAAC;AAZD,0BAYC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '../../../Answerable';
|
|
2
|
-
import { AnswerMappingFunction } from '../AnswerMappingFunction';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Extracts the part of the string between the `startIndex` and `endIndex` indexes, or to the end of the string if `endIndex` is `undefined`.
|
|
6
|
-
*
|
|
7
|
-
* @param {Answerable<number>} startIndex
|
|
8
|
-
* The zero-based index at which to begin extraction.
|
|
9
|
-
*
|
|
10
|
-
* If negative, it is treated as `str.length + startIndex`. For example, if `startIndex` is `-3`, it is treated as `str.length - 3`
|
|
11
|
-
*
|
|
12
|
-
* If `startIndex` is greater than or equal to `str.length`, an empty string is returned.
|
|
13
|
-
*
|
|
14
|
-
* @param {Answerable<number>} [endIndex]
|
|
15
|
-
* The zero-based index _before_ which to endIndex extraction.
|
|
16
|
-
* The character at this index will not be included.
|
|
17
|
-
*
|
|
18
|
-
* If `endIndex` is omitted or undefined, or greater than `str.length`,
|
|
19
|
-
* `slice()` extracts to the endIndex of the string.
|
|
20
|
-
*
|
|
21
|
-
* If negative, it is treated as `str.length + endIndex`.
|
|
22
|
-
* For example, if `endIndex` is `-3`, it is treated as `str.length - 3`.
|
|
23
|
-
*
|
|
24
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
25
|
-
*
|
|
26
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
|
|
27
|
-
*/
|
|
28
|
-
export declare function slice(startIndex: Answerable<number>, endIndex?: Answerable<number>): AnswerMappingFunction<string, string>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slice = void 0;
|
|
4
|
-
/* eslint-disable unicorn/consistent-function-scoping */
|
|
5
|
-
const tiny_types_1 = require("tiny-types");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Extracts the part of the string between the `startIndex` and `endIndex` indexes, or to the end of the string if `endIndex` is `undefined`.
|
|
9
|
-
*
|
|
10
|
-
* @param {Answerable<number>} startIndex
|
|
11
|
-
* The zero-based index at which to begin extraction.
|
|
12
|
-
*
|
|
13
|
-
* If negative, it is treated as `str.length + startIndex`. For example, if `startIndex` is `-3`, it is treated as `str.length - 3`
|
|
14
|
-
*
|
|
15
|
-
* If `startIndex` is greater than or equal to `str.length`, an empty string is returned.
|
|
16
|
-
*
|
|
17
|
-
* @param {Answerable<number>} [endIndex]
|
|
18
|
-
* The zero-based index _before_ which to endIndex extraction.
|
|
19
|
-
* The character at this index will not be included.
|
|
20
|
-
*
|
|
21
|
-
* If `endIndex` is omitted or undefined, or greater than `str.length`,
|
|
22
|
-
* `slice()` extracts to the endIndex of the string.
|
|
23
|
-
*
|
|
24
|
-
* If negative, it is treated as `str.length + endIndex`.
|
|
25
|
-
* For example, if `endIndex` is `-3`, it is treated as `str.length - 3`.
|
|
26
|
-
*
|
|
27
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
28
|
-
*
|
|
29
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
|
|
30
|
-
*/
|
|
31
|
-
function slice(startIndex, endIndex) {
|
|
32
|
-
return (actor) => (value) => {
|
|
33
|
-
(0, tiny_types_1.ensure)('The value to be mapped', value, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
|
|
34
|
-
return Promise.all([
|
|
35
|
-
actor.answer(startIndex),
|
|
36
|
-
actor.answer(endIndex),
|
|
37
|
-
]).then(([start, end]) => {
|
|
38
|
-
(0, tiny_types_1.ensure)('startIndex', start, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isInteger)());
|
|
39
|
-
if (end !== undefined) {
|
|
40
|
-
(0, tiny_types_1.ensure)('endIndex', end, (0, tiny_types_1.isInteger)());
|
|
41
|
-
}
|
|
42
|
-
return value.slice(start, end);
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
exports.slice = slice;
|
|
47
|
-
//# sourceMappingURL=slice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slice.js","sourceRoot":"","sources":["../../../../../src/screenplay/questions/mappings/string/slice.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAoE;AAMpE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,KAAK,CAAC,UAA8B,EAAE,QAA6B;IAC/E,OAAO,CAAC,KAAuB,EAAE,EAAE,CAC/B,CAAC,KAAa,EAAE,EAAE;QAEd,IAAA,mBAAM,EAAC,wBAAwB,EAAE,KAAK,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,CAAC,CAAA;QAEhE,OAAO,OAAO,CAAC,GAAG,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;YACxB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;SACzB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,KAAK,EAAE,GAAG,CAAE,EAAE,EAAE;YAEvB,IAAA,mBAAM,EAAC,YAAY,EAAE,KAAK,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,sBAAS,GAAE,CAAC,CAAA;YAErD,IAAI,GAAG,KAAK,SAAS,EAAE;gBACnB,IAAA,mBAAM,EAAC,UAAU,EAAE,GAAG,EAAE,IAAA,sBAAS,GAAE,CAAC,CAAC;aACxC;YAED,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACV,CAAC;AApBD,sBAoBC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AnswerMappingFunction } from '../AnswerMappingFunction';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Divides a string into an ordered list of substrings, puts these substrings into an array, and returns the array.
|
|
5
|
-
* The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call.
|
|
6
|
-
*
|
|
7
|
-
* @param {Answerable<string | RegExp>} separator
|
|
8
|
-
* The pattern describing where each split should occur. The separator can be a simple string or it can be a regular expression.
|
|
9
|
-
*
|
|
10
|
-
* @param {Answerable<number>} [limit]
|
|
11
|
-
* A non-negative integer specifying a limit on the number of substrings to be included in the array.
|
|
12
|
-
* If provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array.
|
|
13
|
-
* Any leftover text is not included in the array at all.
|
|
14
|
-
*
|
|
15
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
16
|
-
*
|
|
17
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split
|
|
18
|
-
*/
|
|
19
|
-
export declare function split(separator: string | RegExp, limit?: number): AnswerMappingFunction<string, string[]>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.split = void 0;
|
|
4
|
-
/* eslint-disable unicorn/consistent-function-scoping */
|
|
5
|
-
const tiny_types_1 = require("tiny-types");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Divides a string into an ordered list of substrings, puts these substrings into an array, and returns the array.
|
|
9
|
-
* The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call.
|
|
10
|
-
*
|
|
11
|
-
* @param {Answerable<string | RegExp>} separator
|
|
12
|
-
* The pattern describing where each split should occur. The separator can be a simple string or it can be a regular expression.
|
|
13
|
-
*
|
|
14
|
-
* @param {Answerable<number>} [limit]
|
|
15
|
-
* A non-negative integer specifying a limit on the number of substrings to be included in the array.
|
|
16
|
-
* If provided, splits the string at each occurrence of the specified separator, but stops when limit entries have been placed in the array.
|
|
17
|
-
* Any leftover text is not included in the array at all.
|
|
18
|
-
*
|
|
19
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
20
|
-
*
|
|
21
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split
|
|
22
|
-
*/
|
|
23
|
-
function split(separator, limit) {
|
|
24
|
-
return (actor) => (value) => {
|
|
25
|
-
(0, tiny_types_1.ensure)('The value to be mapped', value, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
|
|
26
|
-
return Promise.all([
|
|
27
|
-
actor.answer(separator),
|
|
28
|
-
actor.answer(limit),
|
|
29
|
-
]).then(([s, l]) => {
|
|
30
|
-
(0, tiny_types_1.ensure)('The separator', value, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)(), (0, tiny_types_1.isNotBlank)());
|
|
31
|
-
return value.split(s, l);
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.split = split;
|
|
36
|
-
//# sourceMappingURL=split.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../../../src/screenplay/questions/mappings/string/split.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,2CAAqE;AAKrE;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,KAAK,CAAC,SAA0B,EAAE,KAAc;IAC5D,OAAO,CAAC,KAAuB,EAAE,EAAE,CAC/B,CAAC,KAAa,EAAE,EAAE;QACd,IAAA,mBAAM,EAAC,wBAAwB,EAAE,KAAK,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,CAAC,CAAA;QAEhE,OAAO,OAAO,CAAC,GAAG,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC;YACvB,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;SACtB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC,CAAE,EAAE,EAAE;YACjB,IAAA,mBAAM,EAAC,eAAe,EAAE,KAAK,EAAE,IAAA,sBAAS,GAAE,EAAE,IAAA,qBAAQ,GAAE,EAAE,IAAA,uBAAU,GAAE,CAAC,CAAC;YAEtE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;AACV,CAAC;AAdD,sBAcC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '../../../Answerable';
|
|
2
|
-
import { AnswerMappingFunction } from '../AnswerMappingFunction';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Returns the calling string value converted to upper case, according to any locale-specific case mappings.
|
|
6
|
-
*
|
|
7
|
-
* @param {Answerable<string | string[]>} [locales]
|
|
8
|
-
* The `locale` parameter indicates the locale to be used to convert to lower case according to any
|
|
9
|
-
* locale-specific case mappings. If multiple locales are given in an `Array`,
|
|
10
|
-
* the [best available locale](https://tc39.es/ecma402/#sec-bestavailablelocale) is used.
|
|
11
|
-
* The default locale is the host environment’s current locale.
|
|
12
|
-
*
|
|
13
|
-
* @returns {AnswerMappingFunction<string, string>}
|
|
14
|
-
*
|
|
15
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase
|
|
16
|
-
*/
|
|
17
|
-
export declare function toLocaleLowerCase(locales?: Answerable<string | string[]>): AnswerMappingFunction<string, string>;
|