first commit
This commit is contained in:
7
node_modules/eol/.editorconfig
generated
vendored
Normal file
7
node_modules/eol/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
13
node_modules/eol/.eslintrc.json
generated
vendored
Normal file
13
node_modules/eol/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"jquery": true,
|
||||
"commonjs": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"indent": ["error", 2],
|
||||
"quotes": ["error", "single"]
|
||||
}
|
||||
}
|
1
node_modules/eol/.gitattributes
generated
vendored
Normal file
1
node_modules/eol/.gitattributes
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text=auto
|
1
node_modules/eol/.npmignore
generated
vendored
Normal file
1
node_modules/eol/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
19
node_modules/eol/LICENSE
generated
vendored
Normal file
19
node_modules/eol/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
60
node_modules/eol/README.md
generated
vendored
Normal file
60
node_modules/eol/README.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# eol
|
||||
[Newline](http://en.wikipedia.org/wiki/Newline) character converter for JavaScript. Available [on npm](https://www.npmjs.com/package/eol).
|
||||
|
||||
```
|
||||
npm install eol --save
|
||||
```
|
||||
|
||||
### `require` or `import`
|
||||
|
||||
```js
|
||||
const eol = require('eol')
|
||||
```
|
||||
|
||||
```js
|
||||
import eol from 'eol'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `eol.auto(text)`
|
||||
- Normalize line endings in <var>text</var> for the current operating system
|
||||
- <b>@return</b> string with line endings normalized to `\r\n` or `\n`
|
||||
|
||||
### `eol.crlf(text)`
|
||||
- Normalize line endings in <var>text</var> to <b>CRLF</b> (Windows, DOS)
|
||||
- <b>@return</b> string with line endings normalized to `\r\n`
|
||||
|
||||
### `eol.lf(text)`
|
||||
- Normalize line endings in <var>text</var> to <b>LF</b> (Unix, OS X)
|
||||
- <b>@return</b> string with line endings normalized to `\n`
|
||||
|
||||
### `eol.cr(text)`
|
||||
- Normalize line endings in <var>text</var> to <b>CR</b> (Mac OS)
|
||||
- <b>@return</b> string with line endings normalized to `\r`
|
||||
|
||||
### `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
|
||||
|
||||
### `eol.split(text)`
|
||||
- Split <var>text</var> by newline
|
||||
- <b>@return</b> array of lines
|
||||
|
||||
### Joining
|
||||
|
||||
Coercing `eol.auto`|`eol.crlf`|`eol.lf`|`eol.cr` to string yields the appropriate character. This is useful for joining.
|
||||
|
||||
```js
|
||||
String(eol.lf) // "\n"
|
||||
eol.split(text).join(eol.auto) // same as eol.auto(text)
|
||||
eol.split(text).filter(line => line).join(eol.auto) // text joined after removing empty lines
|
||||
eol.split(text).slice(-3).join(eol.auto) // last 3 lines joined
|
||||
```
|
||||
|
||||
## License
|
||||
MIT
|
47
node_modules/eol/eol.d.ts
generated
vendored
Normal file
47
node_modules/eol/eol.d.ts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
declare module eol {
|
||||
/**
|
||||
* Normalize line endings in text for the current operating system
|
||||
* @return string with line endings normalized to \r\n or \n
|
||||
*/
|
||||
export function auto(text: string): string;
|
||||
|
||||
/**
|
||||
* Normalize line endings in text to CRLF (Windows, DOS)
|
||||
* @return string with line endings normalized to \r\n
|
||||
*/
|
||||
export function crlf(text: string): string;
|
||||
|
||||
/**
|
||||
* Normalize line endings in text to LF (Unix, OS X)
|
||||
* @return string with line endings normalized to \n
|
||||
*/
|
||||
export function lf(text: string): string;
|
||||
|
||||
/**
|
||||
* Normalize line endings in text to CR (Mac OS)
|
||||
* @return string with line endings normalized to \r
|
||||
*/
|
||||
export function cr(text: string): string;
|
||||
|
||||
/**
|
||||
* Add linebreak before text
|
||||
* @return string with linebreak added before text
|
||||
*/
|
||||
export function before(text: string): string;
|
||||
|
||||
/**
|
||||
* Add linebreak after text
|
||||
* @return string with linebreak added after text
|
||||
*/
|
||||
export function after(text: string): string;
|
||||
|
||||
/**
|
||||
* Split text by newline
|
||||
* @return array of lines
|
||||
*/
|
||||
export function split(text: string): Array<string>;
|
||||
}
|
||||
|
||||
declare module "eol" {
|
||||
export = eol;
|
||||
}
|
41
node_modules/eol/eol.js
generated
vendored
Normal file
41
node_modules/eol/eol.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
!function(root, name, make) {
|
||||
if (typeof module != 'undefined' && module.exports) module.exports = make()
|
||||
else root[name] = make()
|
||||
}(this, 'eol', function() {
|
||||
|
||||
var api = {}
|
||||
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) {
|
||||
function convert(text) {
|
||||
return text.replace(newline, to)
|
||||
}
|
||||
convert.toString = function() {
|
||||
return to
|
||||
}
|
||||
return convert
|
||||
}
|
||||
|
||||
function split(text) {
|
||||
return text.split(newline)
|
||||
}
|
||||
|
||||
api['lf'] = converts('\n')
|
||||
api['cr'] = converts('\r')
|
||||
api['crlf'] = converts('\r\n')
|
||||
api['auto'] = converts(linebreak)
|
||||
api['before'] = before
|
||||
api['after'] = after
|
||||
api['split'] = split
|
||||
return api
|
||||
});
|
38
node_modules/eol/index.html
generated
vendored
Normal file
38
node_modules/eol/index.html
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-US" class="scheme--white">
|
||||
<meta charset="utf-8">
|
||||
<title>EOL converter</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Newline character converter">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
|
||||
<header class="m-b-3">
|
||||
<h1 class="m-b-1">eol converter</h1>
|
||||
<a class="button scheme--light" href="https://github.com/ryanve/eol">Github</a>
|
||||
<a class="button scheme--light" href="https://www.npmjs.com/package/eol">npm</a>
|
||||
</header>
|
||||
|
||||
<form class="js-converter__form">
|
||||
<fieldset class="m-b-2">
|
||||
<label class="block m-b-2">
|
||||
<b>Input</b>
|
||||
<textarea class="area border-radius scheme--white js-converter__input"></textarea>
|
||||
</label>
|
||||
<button type="submit" class="button scheme--dark">Convert line endings to</button>
|
||||
<label class="inline-block m-b-2">
|
||||
<select class="button scheme--light text--uppercase js-converter__method" aria-label="Convert to">
|
||||
<option selected>lf</option>
|
||||
<option>crlf</option>
|
||||
<option>cr</option>
|
||||
</select>
|
||||
</label>
|
||||
</fieldset>
|
||||
<section>
|
||||
<h2 class="inherit-size">Output</h2>
|
||||
<div class="area scheme--white border-radius js-converter__output" contenteditable></div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
<script src="eol.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js"></script>
|
||||
<script src="ui.js"></script>
|
78
node_modules/eol/package.json
generated
vendored
Normal file
78
node_modules/eol/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"eol@0.9.1",
|
||||
"D:\\Projects\\siag\\vanillajs-seed"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "eol@0.9.1",
|
||||
"_id": "eol@0.9.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg==",
|
||||
"_location": "/eol",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "eol@0.9.1",
|
||||
"name": "eol",
|
||||
"escapedName": "eol",
|
||||
"rawSpec": "0.9.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.9.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/i18next-scanner"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/eol/-/eol-0.9.1.tgz",
|
||||
"_spec": "0.9.1",
|
||||
"_where": "D:\\Projects\\siag\\vanillajs-seed",
|
||||
"author": {
|
||||
"name": "Ryan Van Etten"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ryanve/eol/issues"
|
||||
},
|
||||
"description": "Newline character converter",
|
||||
"devDependencies": {
|
||||
"aok": "^1.9.0",
|
||||
"eslint": "^3.15.0"
|
||||
},
|
||||
"homepage": "https://github.com/ryanve/eol",
|
||||
"keywords": [
|
||||
"eol",
|
||||
"lf",
|
||||
"cr",
|
||||
"crlf",
|
||||
"newline",
|
||||
"newlines",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"character",
|
||||
"formatting",
|
||||
"format",
|
||||
"string",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"ender",
|
||||
"file"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "eol.js",
|
||||
"name": "eol",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ryanve/eol.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext .js",
|
||||
"pretest": "npm run lint",
|
||||
"preversion": "npm test",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"types": "eol.d.ts",
|
||||
"typings": "eol.d.ts",
|
||||
"version": "0.9.1"
|
||||
}
|
81
node_modules/eol/style.css
generated
vendored
Normal file
81
node_modules/eol/style.css
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
.scheme--white { background: whitesmoke; color: black }
|
||||
.scheme--dark { background: blue; color: whitesmoke }
|
||||
.scheme--light { background: gainsboro; color: blue }
|
||||
:focus { outline-color: blue }
|
||||
|
||||
*, :before, :after { box-sizing: border-box }
|
||||
html { font: 1em/2 sans-serif; }
|
||||
body { width: 100%; margin: auto; padding: 1em }
|
||||
a { text-decoration: none }
|
||||
a:hover { text-decoration: underline }
|
||||
textarea, select { font: inherit }
|
||||
textarea { max-width: 100%; margin: 0 }
|
||||
header, section { display: block }
|
||||
fieldset { padding: 0; border: 0 }
|
||||
label { margin: 0; padding: 0 }
|
||||
h1, h2 { line-height: 1 }
|
||||
|
||||
.border-radius {
|
||||
border-radius: .25em;
|
||||
}
|
||||
|
||||
.inherit-size {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
.button {
|
||||
font-size: inherit;
|
||||
font-style: inherit;
|
||||
font-weight: bold;
|
||||
min-height: 2.5em;
|
||||
display: inline-block;
|
||||
border: 0;
|
||||
border-radius: .25em;
|
||||
padding: .33333em .66666em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.button:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.button:enabled:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.m-b-1 {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
.m-b-2 {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.m-b-3 {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.inline-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.area {
|
||||
white-space: pre-wrap;
|
||||
border: 2px solid gainsboro;
|
||||
padding: .25em;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
resize: vertical;
|
||||
width: 100%;
|
||||
height: 7.5em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.text--uppercase {
|
||||
text-transform: uppercase;
|
||||
}
|
64
node_modules/eol/test.js
generated
vendored
Normal file
64
node_modules/eol/test.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
!function(root) {
|
||||
function contains(str, needle) {
|
||||
return !!~str.indexOf(needle);
|
||||
}
|
||||
|
||||
function identity(v) {
|
||||
return v
|
||||
}
|
||||
|
||||
var common = typeof module != 'undefined' && !!module.exports
|
||||
var aok = common ? require('aok') : root.aok
|
||||
var eol = common ? require('./') : root.eol
|
||||
var isWindows = typeof process != 'undefined' && 'win32' === process.platform
|
||||
var meths = ['lf', 'cr', 'crlf', 'auto']
|
||||
var chars = ['\n', '\r', '\r\n', isWindows ? '\r\n' : '\n']
|
||||
var sample = ' ' + chars.join() + 'text' + chars.join()
|
||||
|
||||
aok.prototype.fail = function() {
|
||||
throw new Error('FAILED TEST: ' + this.id)
|
||||
}
|
||||
|
||||
aok('contains sees contained text', contains('ab', 'a') === true)
|
||||
aok('sample contains newlines', contains(sample, '\n') && contains(sample, '\r'))
|
||||
aok('returns other strings as is', eol.auto('random') === 'random')
|
||||
aok('returns empty strings as is', eol.auto('') === '')
|
||||
aok('whitespace intact', eol.lf(' \t ') === ' \t ')
|
||||
aok('lf repeat newlines intact', eol.lf('\n\n\r\r') === '\n\n\n\n')
|
||||
aok('cr repeat newlines intact', eol.cr('\n\n\r\r') === '\r\r\r\r')
|
||||
aok('crlf repeat newlines intact', eol.crlf('\r\n\r\n') === '\r\n\r\n')
|
||||
aok('lf function coerces to string', String(eol.lf) === '\n')
|
||||
aok('crlf function coerces to string', String(eol.crlf) === '\r\n')
|
||||
aok('cr function coerces to string', String(eol.cr) === '\r')
|
||||
aok('auto function coerces to string', String(eol.auto) === isWindows ? '\r\n' : '\n')
|
||||
aok('split return type', eol.split('0\n1\n2') instanceof Array)
|
||||
aok('split lf', eol.split('0\n1\n2').join('') === '012')
|
||||
aok('split cr', eol.split('0\r1\r2').join('') === '012')
|
||||
aok('split crlf', eol.split('0\r\n1\r\n2').join('') === '012')
|
||||
aok('split mixed', eol.split('0\r\n1\n2\r3\r\n4').join('') === '01234')
|
||||
aok('split join', eol.split('0\n1\n\n2\n').join(eol.auto) === eol.auto('0\n1\n\n2\n'))
|
||||
aok('split filter join', eol.split('A\n\nB').filter(identity).join(eol.lf) === 'A\nB')
|
||||
aok('split slice join', eol.split('A\nB\nC\nD').slice(-2).join(eol.lf) === 'C\nD')
|
||||
|
||||
aok.pass(meths, function(method, i) {
|
||||
var normalized = eol[method](sample)
|
||||
aok(method + ' retains', contains(normalized, chars[i]))
|
||||
aok(method + ' normalizes', !aok.fail(chars, function(c) {
|
||||
return contains(chars[i], c) === contains(normalized, c)
|
||||
}))
|
||||
|
||||
return eol.auto(sample) === normalized
|
||||
})
|
||||
|
||||
aok('auto is aware', eol[isWindows ? 'crlf' : 'lf'](sample) === eol.auto(sample))
|
||||
aok('auto matches only 1 and self', aok.pass(meths, function(method) {
|
||||
return eol.auto(sample) === eol[method](sample);
|
||||
}) === 2)
|
||||
|
||||
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);
|
9
node_modules/eol/ui.js
generated
vendored
Normal file
9
node_modules/eol/ui.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/* global eol */
|
||||
$('.js-converter__form').on('submit', function(e) {
|
||||
e.preventDefault()
|
||||
var $form = $(this)
|
||||
var $output = $form.find('.js-converter__output')
|
||||
var method = $form.find('.js-converter__method')[0].value
|
||||
var text = $form.find('.js-converter__input')[0].value
|
||||
$output.text(eol[method](text))
|
||||
});
|
Reference in New Issue
Block a user