⌈⌋ ⎇ branch:  Bitrhythm


Hex Artifact Content

Artifact 9c446fa31195e997ad239636ce23e64bf5cb3c966d66fcd371c58947b1044580:


0000: 2f 2a 2a 0a 20 2a 20 43 6f 6e 76 65 72 74 20 61  /**. * Convert a
0010: 20 73 74 72 69 6e 67 20 63 6f 6e 74 61 69 6e 69   string containi
0020: 6e 67 20 64 61 73 68 65 73 20 74 6f 20 63 61 6d  ng dashes to cam
0030: 65 6c 20 63 61 73 65 0a 20 2a 20 40 70 61 72 61  el case. * @para
0040: 6d 20 20 20 7b 20 53 74 72 69 6e 67 20 7d 20 73  m   { String } s
0050: 74 72 20 2d 20 69 6e 70 75 74 20 73 74 72 69 6e  tr - input strin
0060: 67 0a 20 2a 20 40 72 65 74 75 72 6e 73 20 7b 20  g. * @returns { 
0070: 53 74 72 69 6e 67 20 7d 20 6d 79 2d 73 74 72 69  String } my-stri
0080: 6e 67 20 2d 3e 20 6d 79 53 74 72 69 6e 67 0a 20  ng -> myString. 
0090: 2a 2f 0a 65 78 70 6f 72 74 20 64 65 66 61 75 6c  */.export defaul
00a0: 74 20 66 75 6e 63 74 69 6f 6e 20 74 6f 43 61 6d  t function toCam
00b0: 65 6c 28 73 74 72 29 20 7b 0a 20 20 72 65 74 75  el(str) {.  retu
00c0: 72 6e 20 73 74 72 2e 72 65 70 6c 61 63 65 28 2f  rn str.replace(/
00d0: 2d 28 5c 77 29 2f 67 2c 20 28 5f 2c 20 63 29 20  -(\w)/g, (_, c) 
00e0: 3d 3e 20 63 2e 74 6f 55 70 70 65 72 43 61 73 65  => c.toUpperCase
00f0: 28 29 29 0a 7d                                   ()).}