time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (3517B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2021 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # pascalcase
     22 
     23 > Convert a string to Pascal case.
     24 
     25 <!-- Package usage documentation. -->
     26 
     27 <section class="usage">
     28 
     29 ## Usage
     30 
     31 ```javascript
     32 var pascalcase = require( '@stdlib/string/pascalcase' );
     33 ```
     34 
     35 #### pascalcase( str )
     36 
     37 Converts a string to Pascal case.
     38 
     39 ```javascript
     40 var out = pascalcase( 'foo bar' );
     41 // returns 'FooBar'
     42 
     43 out = pascalcase( 'IS_MOBILE' );
     44 // returns 'IsMobile'
     45 
     46 out = pascalcase( 'Hello World!' );
     47 // returns 'HelloWorld'
     48 
     49 out = pascalcase( '--foo-bar--' );
     50 // returns 'FooBar'
     51 ```
     52 
     53 </section>
     54 
     55 <!-- /.usage -->
     56 
     57 <!-- Package usage examples. -->
     58 
     59 <section class="examples">
     60 
     61 ## Examples
     62 
     63 ```javascript
     64 var pascalcase = require( '@stdlib/string/pascalcase' );
     65 
     66 var str = 'Hello World!';
     67 var out = pascalcase( str );
     68 // returns 'HelloWorld'
     69 
     70 str = 'HELLO WORLD!';
     71 out = pascalcase( str );
     72 // returns 'HelloWorld'
     73 
     74 str = 'To be, or not to be: that is the question.';
     75 out = pascalcase( str );
     76 // returns 'ToBeOrNotToBeThatIsTheQuestion'
     77 ```
     78 
     79 </section>
     80 
     81 <!-- /.examples -->
     82 
     83 * * *
     84 
     85 <section class="cli">
     86 
     87 ## CLI
     88 
     89 <section class="usage">
     90 
     91 ### Usage
     92 
     93 ```text
     94 Usage: pascalcase [options] [<string>]
     95 
     96 Options:
     97 
     98   -h,    --help                Print this message.
     99   -V,    --version             Print the package version.
    100          --split sep           Delimiter for stdin data. Default: '/\\r?\\n/'.
    101 ```
    102 
    103 </section>
    104 
    105 <!-- /.usage -->
    106 
    107 <section class="notes">
    108 
    109 ### Notes
    110 
    111 -   If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes.
    112 
    113     ```bash
    114     # Not escaped...
    115     $ echo -n $'beEp booP\nisMobile' | pascalcase --split /\r?\n/
    116 
    117     # Escaped...
    118     $ echo -n $'beEp booP\nisMobile' | pascalcase --split /\\r?\\n/
    119     ```
    120 
    121 -   The implementation ignores trailing delimiters.
    122 
    123 </section>
    124 
    125 <!-- /.notes -->
    126 
    127 <section class="examples">
    128 
    129 ### Examples
    130 
    131 ```bash
    132 $ pascalcase 'hello world!'
    133 HelloWorld
    134 ```
    135 
    136 To use as a [standard stream][standard-streams],
    137 
    138 ```bash
    139 $ echo -n 'beEp booP' | pascalcase
    140 BeEpBooP
    141 ```
    142 
    143 By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option.
    144 
    145 ```bash
    146 $ echo -n 'beep_boop\tisMobile' | pascalcase --split '\t'
    147 BeepBoop
    148 IsMobile
    149 ```
    150 
    151 </section>
    152 
    153 <!-- /.examples -->
    154 
    155 </section>
    156 
    157 <!-- /.cli -->
    158 
    159 <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
    160 
    161 <section class="related">
    162 
    163 </section>
    164 
    165 <!-- /.related -->
    166 
    167 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    168 
    169 <section class="links">
    170 
    171 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
    172 
    173 [mdn-regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
    174 
    175 <!-- <related-links> -->
    176 
    177 <!-- </related-links> -->
    178 
    179 </section>
    180 
    181 <!-- /.links -->