Skip to content

Commit f67fef7

Browse files
committed
feature(format) es2015-ify
1 parent 75c3630 commit f67fef7

11 files changed

Lines changed: 380 additions & 213 deletions

File tree

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env"
4+
]
5+
}

.eslintrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true,
5+
},
6+
"parserOptions": {
7+
"ecmaVersion": 2017,
8+
},
9+
"rules": {
10+
"indent": ["error", 4],
11+
"semi": "error",
12+
"no-console": 0,
13+
"no-use-before-define": ["error", "nofunc"]
14+
},
15+
"extends": [
16+
"eslint:recommended",
17+
"plugin:node/recommended"
18+
],
19+
"plugins": [
20+
"node"
21+
]
22+
}

.eslintrc.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true,
5+
},
6+
"parserOptions": {
7+
"ecmaVersion": 2017,
8+
},
9+
"rules": {
10+
"indent": ["error", 4],
11+
"semi": "error",
12+
"no-console": 0,
13+
"no-use-before-define": ["error", "nofunc"]
14+
},
15+
"extends": [
16+
"eslint:recommended",
17+
]
18+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
legacy
3+
yarn-error.log
4+
*.swp
5+
.nyc_output
6+

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
yarn-error.log
2+
legacy
3+
test
4+
5+
.*
6+

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 coderaiser
3+
Copyright (c) 2014-2018 coderaiser
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,65 @@
1-
# Format
1+
# Format [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
22

3-
Library for format size, permissions, etc.
3+
Format size, permissions, etc.
44

55
# How to use?
66

77
Format could be used in browser or node.
88

9-
In browser:
10-
119
```js
12-
<script src='lib/format.js'></script>
13-
```
14-
15-
In node:
16-
17-
```js
18-
var Format = require('format-io');
10+
const format = require('format-io');
1911
```
2012

2113
# API
2214

2315
## size
2416

2517
```js
26-
var size = 1024 * 1024 * 5,
27-
sizeStr = Format.size(size);
28-
//'5.00mb'
18+
const size = 1024 * 1024 * 5;
19+
format.size(size);
20+
// returns
21+
'5.00mb'
2922
```
3023

3124
## permissions.symbolic
3225

3326
```js
34-
var perm = '00777',
35-
permStr = Format.permissions.symbolic(perm);
36-
//'rwx rwx rwx
27+
const perm = '00777';
28+
format.permissions.symbolic(perm);
29+
// returns
30+
'rwx rwx rwx'
3731
```
3832

3933
## permissions.numeric
4034

4135
```js
42-
var perm = 'rwx rwx rwx',
43-
permNum = Format.permissions.numeric(perm);
44-
//'00777'
36+
const perm = 'rwx rwx rwx';
37+
format.permissions.numeric(perm);
38+
// returns
39+
'00777'
40+
```
41+
42+
## Environments
43+
44+
In environments that not supports `es2015`, `format` can be used with:
45+
46+
```js
47+
var format = require('format/legacy');
4548
```
4649

4750
# License
4851

4952
MIT
53+
54+
[NPMIMGURL]: https://img.shields.io/npm/v/format-io.svg?style=flat
55+
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/format-io/master.svg?style=flat
56+
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/format-io.svg?style=flat
57+
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
58+
[NPMURL]: https://npmjs.org/package/format-io "npm"
59+
[BuildStatusURL]: https://travis-ci.org/coderaiser/format-io "Build Status"
60+
[DependencyStatusURL]: https://david-dm.org/coderaiser/format-io "Dependency Status"
61+
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
62+
63+
[CoverageURL]: https://coveralls.io/github/coderaiser/format-io?branch=master
64+
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/format-io/badge.svg?branch=master&service=github
65+

bower.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)