index.js (1744B)
1 /** 2 * @license Apache-2.0 3 * 4 * Copyright (c) 2018 The Stdlib Authors. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 'use strict'; 20 21 /** 22 * Platform-specific path delimiter. 23 * 24 * @module @stdlib/constants/path/delimiter 25 * @type {string} 26 * 27 * @example 28 * var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); 29 * var PATH_DELIMITER = require( '@stdlib/constants/path/delimiter' ); 30 * 31 * var PATH; 32 * var paths; 33 * 34 * if ( IS_WINDOWS ) { 35 * PATH = 'C:\\Windows\\system32;C:\\Windows;C:\\Program Files\\node\\'; 36 * paths = PATH.split( PATH_DELIMITER ); 37 * // returns ['C:\\Windows\\system32','C:\\Windows','C:\\Program Files\\node\\'] 38 * } else { 39 * PATH = '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'; 40 * paths = PATH.split( PATH_DELIMITER ); 41 * // returns ['/usr/bin','/bin','/usr/sbin','/sbin','/usr/local/bin'] 42 * } 43 */ 44 45 // MODULES // 46 47 var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); 48 var PATH_DELIMITER_WIN32 = require( './../../../path/delimiter-win32' ); 49 var PATH_DELIMITER_POSIX = require( './../../../path/delimiter-posix' ); 50 51 52 // MAIN // 53 54 var PATH_DELIMITER; 55 if ( IS_WINDOWS ) { 56 PATH_DELIMITER = PATH_DELIMITER_WIN32; 57 } else { 58 PATH_DELIMITER = PATH_DELIMITER_POSIX; 59 } 60 61 62 // EXPORTS // 63 64 module.exports = PATH_DELIMITER;