Skip to content

Commit

Permalink
Merge ffe2dca into 9a0848c
Browse files Browse the repository at this point in the history
  • Loading branch information
VovanR committed Dec 30, 2020
2 parents 9a0848c + ffe2dca commit 7838530
Show file tree
Hide file tree
Showing 11 changed files with 11,633 additions and 297 deletions.
7 changes: 2 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
root = true

[*]
indent_style = tab
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{json,yml,md}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
34 changes: 34 additions & 0 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests
on: [push, pull_request]

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 15
- 14
- 12
- 10
steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- run: npm test
env:
CI: true

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@
<a name="1.0.3"></a>
## [1.0.3](https://github.com/vovanr/format-thousands/compare/v1.0.2...v1.0.3) (2016-04-21)




8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![XO code style][codestyle-image]][codestyle-url]

[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Build Status][build-image]][build-url]
[![Coveralls Status][coveralls-image]][coveralls-url]
[![Dependency Status][depstat-image]][depstat-url]
[![DevDependency Status][depstat-dev-image]][depstat-dev-url]
Expand Down Expand Up @@ -54,14 +54,14 @@ MIT © [Vladimir Rodkin](https://github.com/VovanR)
[commitizen-url]: https://commitizen.github.io/cz-cli/
[commitizen-image]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square

[codestyle-url]: https://github.com/sindresorhus/xo
[codestyle-url]: https://github.com/xojs/xo
[codestyle-image]: https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square

[npm-url]: https://npmjs.org/package/format-thousands
[npm-image]: https://img.shields.io/npm/v/format-thousands.svg?style=flat-square

[travis-url]: https://travis-ci.org/VovanR/format-thousands
[travis-image]: https://img.shields.io/travis/VovanR/format-thousands.svg?style=flat-square
[build-url]: https://github.com/VovanR/format-thousands/actions?query=workflow%3A%22Tests%22
[build-image]: https://img.shields.io/github/workflow/status/VovanR/format-thousands/Tests?style=flat-square

[coveralls-url]: https://coveralls.io/r/VovanR/format-thousands
[coveralls-image]: https://img.shields.io/coveralls/VovanR/format-thousands.svg?style=flat-square
Expand Down
177 changes: 88 additions & 89 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,108 +1,107 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>format-thousands</title>
<title>format-thousands</title>
<meta name="description" content="Format thousands with custom separator: 1 000 000">

<link rel="stylesheet" href="style.css">
</head>
<body>
<link rel="stylesheet" href="style.css">
</head>
<body>

<form
class="formatter"
action=""
>
<div class="formatter__input">
<input
class="formatter__control formatter__control_name_number"
value="1000000"
type="number"
name="number"
placeholder="number"
/>
<form
class="formatter"
action=""
>
<div class="formatter__input">
<input
class="formatter__control formatter__control_name_number"
value="1000000"
type="number"
name="number"
placeholder="number"
/>

<div class="formatter__options">
<input
class="formatter__control formatter__control_name_separator"
value=""
type="text"
name="separator"
placeholder="separator"
/>
<div class="formatter__options">
<input
class="formatter__control formatter__control_name_separator"
value=""
type="text"
name="separator"
placeholder="separator"
/>

<label class="formatter__checkbox">
<input
name="formatFourDigits"
value="formatFourDigits"
checked="checked"
type="checkbox"
/>
<label class="formatter__checkbox">
<input
name="formatFourDigits"
value="formatFourDigits"
checked="checked"
type="checkbox"
/>

<span>
format four digits
</span>
</label>
</div>
</div>
<span>
format four digits
</span>
</label>
</div>
</div>

<div class="formatter__output">
<input
class="formatter__control formatter__control_name_result"
value=""
readonly
type="text"
name="result"
placeholder="result"
/>
</label>
</div>
</form>
<div class="formatter__output">
<input
class="formatter__control formatter__control_name_result"
value=""
readonly
type="text"
name="result"
placeholder="result"
/>
</div>
</form>

<a
class="copyright"
href="https://github.com/vovanr/format-thousands"
target="_blank"
rel="noopener noreferrer"
tabindex="-1"
>
<span class="copyright__license">MIT ©</span> <span class="copyright__author">Vladimir Rodkin</span>
</a>
<a
class="copyright"
href="https://github.com/vovanr/format-thousands"
target="_blank"
rel="noopener noreferrer"
tabindex="-1"
>
<span class="copyright__license">MIT ©</span> <span class="copyright__author">Vladimir Rodkin</span>
</a>

<script>window.module = {}</script>
<script src="index.js"></script>
<script>
(function (formatThousands) {
'use strict'
<script>window.module = {}</script>
<script src="index.js"></script>
<script>
(function (formatThousands) {
'use strict'

var form = document.forms[0]
var elements = form.elements
var numberControl = elements.number
var separatorControl = elements.separator
var resultControl = elements.result
var formatFourDigits = elements.formatFourDigits
var form = document.forms[0]
var elements = form.elements
var numberControl = elements.number
var separatorControl = elements.separator
var resultControl = elements.result
var formatFourDigits = elements.formatFourDigits

form.addEventListener('input', renderResult)
form.addEventListener('change', renderResult)
form.addEventListener('submit', function (event) {
event.preventDefault();
})
form.addEventListener('input', renderResult)
form.addEventListener('change', renderResult)
form.addEventListener('submit', function (event) {
event.preventDefault();
})

function renderResult() {
var options = {
separator: separatorControl.value || undefined,
formatFourDigits: formatFourDigits.checked
}
resultControl.value = formatThousands(numberControl.value, options)
}
function renderResult() {
var options = {
separator: separatorControl.value || undefined,
formatFourDigits: formatFourDigits.checked
}
resultControl.value = formatThousands(numberControl.value, options)
}

renderResult()
renderResult()

})(window.module.exports)
</script>
})(window.module.exports)
</script>

</body>
</body>
</html>
Loading

0 comments on commit 7838530

Please sign in to comment.