1
- 'use strict' ;
2
1
3
- /*** *****************************************************************************************
2
+ /** *****************************************************************************************
4
3
* *
5
4
* Plese read the following tutorial before implementing tasks: *
6
5
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String *
7
6
* *
8
7
********************************************************************************************/
9
8
10
9
11
-
12
10
/**
13
11
* Returns the result of concatenation of two strings.
14
12
*
21
19
* 'aa','' => 'aa'
22
20
* '', 'bb' => 'bb'
23
21
*/
24
- function concatenateStrings ( value1 , value2 ) {
25
- throw new Error ( 'Not implemented' ) ;
22
+ export function concatenateStrings ( value1 , value2 ) {
23
+ /* implement your code here */
24
+ throw new Error ( 'Not implemented' ) ;
26
25
}
27
26
28
-
29
27
/**
30
28
* Returns the length of given string.
31
29
*
@@ -37,8 +35,9 @@ function concatenateStrings(value1, value2) {
37
35
* 'b' => 1
38
36
* '' => 0
39
37
*/
40
- function getStringLength ( value ) {
41
- throw new Error ( 'Not implemented' ) ;
38
+ export function getStringLength ( value ) {
39
+ /* implement your code here */
40
+ throw new Error ( 'Not implemented' ) ;
42
41
}
43
42
44
43
/**
@@ -54,8 +53,9 @@ function getStringLength(value) {
54
53
* 'John','Doe' => 'Hello, John Doe!'
55
54
* 'Chuck','Norris' => 'Hello, Chuck Norris!'
56
55
*/
57
- function getStringFromTemplate ( firstName , lastName ) {
58
- throw new Error ( 'Not implemented' ) ;
56
+ export function getStringFromTemplate ( firstName , lastName ) {
57
+ /* implement your code here */
58
+ throw new Error ( 'Not implemented' ) ;
59
59
}
60
60
61
61
/**
@@ -68,8 +68,9 @@ function getStringFromTemplate(firstName, lastName) {
68
68
* 'Hello, John Doe!' => 'John Doe'
69
69
* 'Hello, Chuck Norris!' => 'Chuck Norris'
70
70
*/
71
- function extractNameFromTemplate ( value ) {
72
- throw new Error ( 'Not implemented' ) ;
71
+ export function extractNameFromTemplate ( value ) {
72
+ /* implement your code here */
73
+ throw new Error ( 'Not implemented' ) ;
73
74
}
74
75
75
76
@@ -83,8 +84,9 @@ function extractNameFromTemplate(value) {
83
84
* 'John Doe' => 'J'
84
85
* 'cat' => 'c'
85
86
*/
86
- function getFirstChar ( value ) {
87
- throw new Error ( 'Not implemented' ) ;
87
+ export function getFirstChar ( value ) {
88
+ /* implement your code here */
89
+ throw new Error ( 'Not implemented' ) ;
88
90
}
89
91
90
92
/**
@@ -98,8 +100,9 @@ function getFirstChar(value) {
98
100
* 'cat' => 'cat'
99
101
* '\tHello, World! ' => 'Hello, World!'
100
102
*/
101
- function removeLeadingAndTrailingWhitespaces ( value ) {
102
- throw new Error ( 'Not implemented' ) ;
103
+ export function removeLeadingAndTrailingWhitespaces ( value ) {
104
+ /* implement your code here */
105
+ throw new Error ( 'Not implemented' ) ;
103
106
}
104
107
105
108
/**
@@ -113,13 +116,14 @@ function removeLeadingAndTrailingWhitespaces(value) {
113
116
* 'A', 5 => 'AAAAA'
114
117
* 'cat', 3 => 'catcatcat'
115
118
*/
116
- function repeatString ( value , count ) {
117
- throw new Error ( 'Not implemented' ) ;
119
+ export function repeatString ( value , count ) {
120
+ /* implement your code here */
121
+ throw new Error ( 'Not implemented' ) ;
118
122
}
119
123
120
124
/**
121
125
* Remove the first occurrence of string inside another string
122
- *
126
+ *
123
127
* @param {string } str
124
128
* @param {string } value
125
129
* @return {string }
@@ -129,8 +133,9 @@ function repeatString(value, count) {
129
133
* 'I like legends', 'end' => 'I like legs',
130
134
* 'ABABAB','BA' => 'ABAB'
131
135
*/
132
- function removeFirstOccurrences ( str , value ) {
133
- throw new Error ( 'Not implemented' ) ;
136
+ export function removeFirstOccurrences ( str , value ) {
137
+ /* implement your code here */
138
+ throw new Error ( 'Not implemented' ) ;
134
139
}
135
140
136
141
/**
@@ -144,8 +149,9 @@ function removeFirstOccurrences(str, value) {
144
149
* '<span>' => 'span'
145
150
* '<a>' => 'a'
146
151
*/
147
- function unbracketTag ( str ) {
148
- throw new Error ( 'Not implemented' ) ;
152
+ export function unbracketTag ( str ) {
153
+ /* implement your code here */
154
+ throw new Error ( 'Not implemented' ) ;
149
155
}
150
156
151
157
@@ -159,8 +165,9 @@ function unbracketTag(str) {
159
165
* 'Thunderstruck' => 'THUNDERSTRUCK'
160
166
* 'abcdefghijklmnopqrstuvwxyz' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
161
167
*/
162
- function convertToUpperCase ( str ) {
163
- throw new Error ( 'Not implemented' ) ;
168
+ export function convertToUpperCase ( str ) {
169
+ /* implement your code here */
170
+ throw new Error ( 'Not implemented' ) ;
164
171
}
165
172
166
173
/**
@@ -170,11 +177,13 @@ function convertToUpperCase(str) {
170
177
* @return {array }
171
178
*
172
179
* @example
173
-
180
+
181
+
174
182
175
183
*/
176
- function extractEmails ( str ) {
177
- throw new Error ( 'Not implemented' ) ;
184
+ export function extractEmails ( str ) {
185
+ /* implement your code here */
186
+ throw new Error ( 'Not implemented' ) ;
178
187
}
179
188
180
189
/**
@@ -200,8 +209,9 @@ function extractEmails(str) {
200
209
* '└──────────┘\n'
201
210
*
202
211
*/
203
- function getRectangleString ( width , height ) {
204
- throw new Error ( 'Not implemented' ) ;
212
+ export function getRectangleString ( width , height ) {
213
+ /* implement your code here */
214
+ throw new Error ( 'Not implemented' ) ;
205
215
}
206
216
207
217
@@ -217,11 +227,13 @@ function getRectangleString(width, height) {
217
227
* 'hello' => 'uryyb'
218
228
* 'Why did the chicken cross the road?' => 'Jul qvq gur puvpxra pebff gur ebnq?'
219
229
* 'Gb trg gb gur bgure fvqr!' => 'To get to the other side!'
220
- * 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' => 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
230
+ * 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' =>
231
+ * 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
221
232
*
222
233
*/
223
- function encodeToRot13 ( str ) {
224
- throw new Error ( 'Not implemented' ) ;
234
+ export function encodeToRot13 ( str ) {
235
+ /* implement your code here */
236
+ throw new Error ( 'Not implemented' ) ;
225
237
}
226
238
227
239
/**
@@ -237,54 +249,37 @@ function encodeToRot13(str) {
237
249
* isString('test') => true
238
250
* isString(new String('test')) => true
239
251
*/
240
- function isString ( value ) {
241
- throw new Error ( 'Not implemented' ) ;
252
+ export function isString ( value ) {
253
+ /* implement your code here */
254
+ throw new Error ( 'Not implemented' ) ;
242
255
}
243
256
244
257
245
258
/**
246
259
* Returns playid card id.
247
- *
260
+ *
248
261
* Playing cards inittial deck inclides the cards in the following order:
249
- *
262
+ *
250
263
* 'A♣','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣',
251
264
* 'A♦','2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦',
252
265
* 'A♥','2♥','3♥','4♥','5♥','6♥','7♥','8♥','9♥','10♥','J♥','Q♥','K♥',
253
266
* 'A♠','2♠','3♠','4♠','5♠','6♠','7♠','8♠','9♠','10♠','J♠','Q♠','K♠'
254
- *
267
+ *
255
268
* (see https://en.wikipedia.org/wiki/Standard_52-card_deck)
256
269
* Function returns the zero-based index of specified card in the initial deck above.
257
- *
270
+ *
258
271
* @param {string } value
259
272
* @return {number }
260
273
*
261
274
* @example
262
275
* 'A♣' => 0
263
- * '2♣' => 1
276
+ * '2♣' => 1
264
277
* '3♣' => 2
265
278
* ...
266
279
* 'Q♠' => 50
267
280
* 'K♠' => 51
268
281
*/
269
- function getCardId ( value ) {
270
- throw new Error ( 'Not implemented' ) ;
282
+ export function getCardId ( value ) {
283
+ /* implement your code here */
284
+ throw new Error ( 'Not implemented' ) ;
271
285
}
272
-
273
-
274
- module . exports = {
275
- concatenateStrings : concatenateStrings ,
276
- getStringLength : getStringLength ,
277
- getStringFromTemplate : getStringFromTemplate ,
278
- extractNameFromTemplate : extractNameFromTemplate ,
279
- getFirstChar : getFirstChar ,
280
- removeLeadingAndTrailingWhitespaces : removeLeadingAndTrailingWhitespaces ,
281
- repeatString : repeatString ,
282
- removeFirstOccurrences : removeFirstOccurrences ,
283
- unbracketTag : unbracketTag ,
284
- convertToUpperCase : convertToUpperCase ,
285
- extractEmails : extractEmails ,
286
- getRectangleString : getRectangleString ,
287
- encodeToRot13 : encodeToRot13 ,
288
- isString : isString ,
289
- getCardId : getCardId
290
- } ;
0 commit comments