Browse Source

os: add cross platform EOL character

v0.9.1-release
Mustansir Golawala 13 years ago
committed by Ben Noordhuis
parent
commit
7ee15457ed
  1. 3
      doc/api/os.markdown
  2. 2
      lib/os.js
  3. 3
      test/simple/test-os.js

3
doc/api/os.markdown

@ -129,3 +129,6 @@ Get a list of network interfaces:
vmnet8: [ { address: '10.88.88.1', family: 'IPv4', internal: false } ], vmnet8: [ { address: '10.88.88.1', family: 'IPv4', internal: false } ],
ppp0: [ { address: '10.2.0.231', family: 'IPv4', internal: false } ] } ppp0: [ { address: '10.2.0.231', family: 'IPv4', internal: false } ] }
## os.EOL
A constant defining the appropriate End-of-line marker for the operating system.

2
lib/os.js

@ -42,3 +42,5 @@ exports.getNetworkInterfaces = function() {
}; };
module.deprecate('getNetworkInterfaces', module.deprecate('getNetworkInterfaces',
'It is now called `os.networkInterfaces`.'); 'It is now called `os.networkInterfaces`.');
exports.EOL = process.platform === 'win32' ? '\r\n' : '\n';

3
test/simple/test-os.js

@ -79,3 +79,6 @@ switch (platform) {
assert.deepEqual(actual, expected); assert.deepEqual(actual, expected);
break; break;
} }
var EOL = os.EOL;
assert.ok(EOL.length > 0);

Loading…
Cancel
Save