README.md (1565B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 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 # Path Separator 22 23 > Platform-specific path segment separator. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var PATH_SEP = require( '@stdlib/constants/path/sep' ); 31 ``` 32 33 #### PATH_SEP 34 35 Platform-specific path segment separator. 36 37 ```javascript 38 var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); 39 40 var bool; 41 if ( IS_WINDOWS ) { 42 bool = ( PATH_SEP === '\\' ); 43 // returns true 44 } else { 45 bool = ( PATH_SEP === '/' ); 46 // returns true 47 } 48 ``` 49 50 </section> 51 52 <!-- /.usage --> 53 54 <section class="examples"> 55 56 ## Examples 57 58 <!-- eslint no-undef: "error" --> 59 60 ```javascript 61 var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); 62 var PATH_SEP = require( '@stdlib/constants/path/sep' ); 63 64 var parts; 65 var path; 66 67 if ( IS_WINDOWS ) { 68 path = 'foo\\bar\\baz'; 69 } else { 70 path = 'foo/bar/baz'; 71 } 72 parts = path.split( PATH_SEP ); 73 console.log( parts ); 74 // => ['foo','bar','baz'] 75 ``` 76 77 </section> 78 79 <!-- /.examples --> 80 81 <section class="links"> 82 83 </section> 84 85 <!-- /.links -->