1- 'use strict' ;
21
3- /*** *****************************************************************************************
2+ /** *****************************************************************************************
43 * *
54 * Plese read the following tutorial before implementing tasks: *
65 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String *
76 * *
87 ********************************************************************************************/
98
109
11-
1210/**
1311 * Returns the result of concatenation of two strings.
1412 *
2119 * 'aa','' => 'aa'
2220 * '', 'bb' => 'bb'
2321 */
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' ) ;
2625}
2726
28-
2927/**
3028 * Returns the length of given string.
3129 *
@@ -37,8 +35,9 @@ function concatenateStrings(value1, value2) {
3735 * 'b' => 1
3836 * '' => 0
3937 */
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' ) ;
4241}
4342
4443/**
@@ -54,8 +53,9 @@ function getStringLength(value) {
5453 * 'John','Doe' => 'Hello, John Doe!'
5554 * 'Chuck','Norris' => 'Hello, Chuck Norris!'
5655 */
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' ) ;
5959}
6060
6161/**
@@ -68,8 +68,9 @@ function getStringFromTemplate(firstName, lastName) {
6868 * 'Hello, John Doe!' => 'John Doe'
6969 * 'Hello, Chuck Norris!' => 'Chuck Norris'
7070 */
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' ) ;
7374}
7475
7576
@@ -83,8 +84,9 @@ function extractNameFromTemplate(value) {
8384 * 'John Doe' => 'J'
8485 * 'cat' => 'c'
8586 */
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' ) ;
8890}
8991
9092/**
@@ -98,8 +100,9 @@ function getFirstChar(value) {
98100 * 'cat' => 'cat'
99101 * '\tHello, World! ' => 'Hello, World!'
100102 */
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' ) ;
103106}
104107
105108/**
@@ -113,13 +116,14 @@ function removeLeadingAndTrailingWhitespaces(value) {
113116 * 'A', 5 => 'AAAAA'
114117 * 'cat', 3 => 'catcatcat'
115118 */
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' ) ;
118122}
119123
120124/**
121125 * Remove the first occurrence of string inside another string
122- *
126+ *
123127 * @param {string } str
124128 * @param {string } value
125129 * @return {string }
@@ -129,8 +133,9 @@ function repeatString(value, count) {
129133 * 'I like legends', 'end' => 'I like legs',
130134 * 'ABABAB','BA' => 'ABAB'
131135 */
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' ) ;
134139}
135140
136141/**
@@ -144,8 +149,9 @@ function removeFirstOccurrences(str, value) {
144149 * '<span>' => 'span'
145150 * '<a>' => 'a'
146151 */
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' ) ;
149155}
150156
151157
@@ -159,8 +165,9 @@ function unbracketTag(str) {
159165 * 'Thunderstruck' => 'THUNDERSTRUCK'
160166 * 'abcdefghijklmnopqrstuvwxyz' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
161167 */
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' ) ;
164171}
165172
166173/**
@@ -170,11 +177,13 @@ function convertToUpperCase(str) {
170177 * @return {array }
171178 *
172179 * @example
173- * 'angus.young@gmail.com;brian.johnson@hotmail.com;bon.scott@yahoo.com' => ['angus.young@gmail.com', 'brian.johnson@hotmail.com', 'bon.scott@yahoo.com']
180+ * 'angus.young@gmail.com;brian.johnson@hotmail.com;bon.scott@yahoo.com' =>
181+ * ['angus.young@gmail.com', 'brian.johnson@hotmail.com', 'bon.scott@yahoo.com']
174182 * 'info@gmail.com' => ['info@gmail.com']
175183 */
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' ) ;
178187}
179188
180189/**
@@ -200,8 +209,9 @@ function extractEmails(str) {
200209 * '└──────────┘\n'
201210 *
202211 */
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' ) ;
205215}
206216
207217
@@ -217,11 +227,13 @@ function getRectangleString(width, height) {
217227 * 'hello' => 'uryyb'
218228 * 'Why did the chicken cross the road?' => 'Jul qvq gur puvpxra pebff gur ebnq?'
219229 * 'Gb trg gb gur bgure fvqr!' => 'To get to the other side!'
220- * 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' => 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
230+ * 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' =>
231+ * 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
221232 *
222233 */
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' ) ;
225237}
226238
227239/**
@@ -237,54 +249,37 @@ function encodeToRot13(str) {
237249 * isString('test') => true
238250 * isString(new String('test')) => true
239251 */
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' ) ;
242255}
243256
244257
245258/**
246259 * Returns playid card id.
247- *
260+ *
248261 * Playing cards inittial deck inclides the cards in the following order:
249- *
262+ *
250263 * 'A♣','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣',
251264 * 'A♦','2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦',
252265 * 'A♥','2♥','3♥','4♥','5♥','6♥','7♥','8♥','9♥','10♥','J♥','Q♥','K♥',
253266 * 'A♠','2♠','3♠','4♠','5♠','6♠','7♠','8♠','9♠','10♠','J♠','Q♠','K♠'
254- *
267+ *
255268 * (see https://en.wikipedia.org/wiki/Standard_52-card_deck)
256269 * Function returns the zero-based index of specified card in the initial deck above.
257- *
270+ *
258271 * @param {string } value
259272 * @return {number }
260273 *
261274 * @example
262275 * 'A♣' => 0
263- * '2♣' => 1
276+ * '2♣' => 1
264277 * '3♣' => 2
265278 * ...
266279 * 'Q♠' => 50
267280 * 'K♠' => 51
268281 */
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' ) ;
271285}
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