Comparing version 0.3.0 to 0.4.0
14
eol.js
@@ -8,4 +8,13 @@ !function(root, name, make) { | ||
var isWindows = typeof process != 'undefined' && 'win32' === process.platform | ||
var linebreak = isWindows ? '\r\n' : '\n' | ||
var newline = /\r\n|\r|\n/g | ||
function before(text) { | ||
return linebreak + text | ||
} | ||
function after(text) { | ||
return text + linebreak | ||
} | ||
function converts(to) { | ||
@@ -20,5 +29,6 @@ return function(text) { | ||
api['crlf'] = converts('\r\n') | ||
api['auto'] = converts(isWindows ? '\r\n' : '\n') | ||
api['auto'] = converts(linebreak) | ||
api['before'] = before | ||
api['after'] = after | ||
return api | ||
}); |
{ | ||
"name": "eol", | ||
"description": "Newline character converter", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/ryanve/eol", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -30,3 +30,11 @@ # eol | ||
### `eol.before(text)` | ||
- Add linebreak before <var>text</var> | ||
- <b>@return</b> string with linebreak added before text | ||
### `eol.after(text)` | ||
- Add linebreak after <var>text</var> | ||
- <b>@return</b> string with linebreak added after text | ||
## License | ||
MIT |
@@ -42,3 +42,8 @@ !function(root) { | ||
aok('before', eol.lf(eol.before('text')) === '\ntext') | ||
aok('before2', eol.lf(eol.before('\ntext\n')) === '\n\ntext\n') | ||
aok('after', eol.lf(eol.after('text')) === 'text\n') | ||
aok('after2', eol.lf(eol.after('\ntext\n')) === '\ntext\n\n') | ||
aok.log('All tests passed =)') | ||
}(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6284
67
40