Skip to content

Commit 1bd9a51

Browse files
author
David Chase
committed
fix rollup config, and add standard
1 parent 9c3b870 commit 1bd9a51

File tree

7 files changed

+68
-66
lines changed

7 files changed

+68
-66
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
![](https://img.shields.io/badge/purely%20functional-%CE%BB-blue.svg?style=flat-square)
44
[![API stability](https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square)](https://nodejs.org/api/documentation.html#documentation_stability_index)
55
[![npm version](https://img.shields.io/npm/v/composable-normalize.svg?style=flat-square)](https://www.npmjs.com/package/composable-normalize)
6+
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
67
# composable-normalize
78
Experiment to normalize URLs w/ functional programming
89

@@ -14,18 +15,18 @@ npm i --save-dev composable-normalize
1415
## Usage
1516

1617
```js
17-
import normalize from 'composable-normalize';
18+
import normalize from 'composable-normalize'
1819

19-
normalize('HTTP://www.Github.com/');
20+
normalize('HTTP://www.Github.com/')
2021
//=> 'http://www.github.com/'
2122

22-
normalize('http://www.github.com/../a/b/../c/./d');
23+
normalize('http://www.github.com/../a/b/../c/./d')
2324
// => 'http://www.github.com/a/c/d'
2425

25-
normalize('http://www.github.com:80/bar');
26+
normalize('http://www.github.com:80/bar')
2627
// => 'http://www.github.com/bar'
2728

28-
normalize('http://www.github.com/%7Eusername/');
29+
normalize('http://www.github.com/%7Eusername/')
2930
// => 'http://www.github.com/~username'
3031
```
3132

dist/composable-normalize.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
(function (global, factory) {
22
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
33
typeof define === 'function' && define.amd ? define(factory) :
4-
(global.pullDomEvents = factory());
5-
}(this, function () { 'use strict';
4+
(global.composableNormalize = factory());
5+
}(this, (function () { 'use strict';
66

7-
// decode :: String -> String
8-
var decode = decodeURIComponent;
7+
// decode :: String -> String
8+
var decode = decodeURIComponent
99

10-
// _compose :: (b -> c) -> (a -> b) -> (a -> c)
11-
var _compose = function (f, g) { return function () {
12-
var args = [], len = arguments.length;
13-
while ( len-- ) args[ len ] = arguments[ len ];
10+
// _compose :: (b -> c) -> (a -> b) -> (a -> c)
11+
var _compose = function (f, g) { return function () {
12+
var args = [], len = arguments.length;
13+
while ( len-- ) args[ len ] = arguments[ len ];
1414

15-
return f(g.apply(void 0, args));
16-
; } };
15+
return f(g.apply(void 0, args));
16+
; } }
1717

18-
// compose :: (a -> c) -> [(a -> a)] -> (a -> c)
19-
var compose = function (fns) { return fns.reduce(_compose); };
18+
// compose :: (a -> c) -> [(a -> a)] -> (a -> c)
19+
var compose = function (fns) { return fns.reduce(_compose); }
2020

21-
// replace :: Regex -> String -> String -> String
22-
var replace = function (pattern, substr) { return function (str) { return str.replace(pattern, substr); }; };
21+
// replace :: Regex -> String -> String -> String
22+
var replace = function (pattern, substr) { return function (str) { return str.replace(pattern, substr); }; }
2323

24-
// toLower :: String -> String
25-
var toLower = function (str) { return str.toLowerCase(); };
24+
// toLower :: String -> String
25+
var toLower = function (str) { return str.toLowerCase(); }
2626

27-
// append :: String -> String -> String
28-
var append = function (a) { return function (b) { return b.concat(a); }; };
27+
// append :: String -> String -> String
28+
var append = function (a) { return function (b) { return b.concat(a); }; }
2929

30-
var dedupeSlashes = /([^:]\/)\/+/g;
31-
var dedupeDots = /\/\.+/g;
32-
var defaultPorts = /(\:80|\:443)/;
30+
var dedupeSlashes = /([^:]\/)\/+/g
31+
var dedupeDots = /\/\.+/g
32+
var defaultPorts = /(:80|:443)/
3333

34-
var index = compose([
35-
replace(dedupeSlashes, '$1'),
36-
replace(dedupeDots, '/'),
37-
replace(defaultPorts, ''),
38-
toLower,
39-
append('/'),
40-
decode
41-
]);
34+
var index = compose([
35+
replace(dedupeSlashes, '$1'),
36+
replace(dedupeDots, '/'),
37+
replace(defaultPorts, ''),
38+
toLower,
39+
append('/'),
40+
decode
41+
])
4242

43-
return index;
43+
return index;
4444

45-
}));
45+
})));

dist/composable-normalize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
'use strict';
1+
'use strict'
22

3-
import {compose, toLower, replace, append, decode} from './prelude';
3+
import { compose, toLower, replace, append, decode } from './prelude'
44

5-
const dedupeSlashes = /([^:]\/)\/+/g;
6-
const dedupeDots = /\/\.+/g;
7-
const defaultPorts = /(\:80|\:443)/;
5+
const dedupeSlashes = /([^:]\/)\/+/g
6+
const dedupeDots = /\/\.+/g
7+
const defaultPorts = /(:80|:443)/
88

99
export default compose([
10-
replace(dedupeSlashes, '$1'),
11-
replace(dedupeDots, '/'),
12-
replace(defaultPorts, ''),
13-
toLower,
14-
append('/'),
15-
decode
16-
]);
10+
replace(dedupeSlashes, '$1'),
11+
replace(dedupeDots, '/'),
12+
replace(defaultPorts, ''),
13+
toLower,
14+
append('/'),
15+
decode
16+
])

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"url": "git+https://github.com/davidchase/composable-normalize.git"
2121
},
2222
"scripts": {
23-
"build": "rollup -c -f umd -o dist/composable-normalize.js && uglifyjs dist/composable-normalize.js -o dist/composable-normalize.min.js"
23+
"build": "rollup -c && uglifyjs dist/composable-normalize.js -o dist/composable-normalize.min.js"
2424
},
2525
"devDependencies": {
2626
"rollup": "0.34.10",

prelude.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
'use strict';
1+
'use strict'
22

33
// decode :: String -> String
4-
const decode = decodeURIComponent;
4+
const decode = decodeURIComponent
55

66
// _compose :: (b -> c) -> (a -> b) -> (a -> c)
7-
const _compose = (f, g) => (...args) => f(g(...args));
7+
const _compose = (f, g) => (...args) => f(g(...args))
88

99
// compose :: (a -> c) -> [(a -> a)] -> (a -> c)
10-
const compose = fns => fns.reduce(_compose);
10+
const compose = fns => fns.reduce(_compose)
1111

1212
// replace :: Regex -> String -> String -> String
13-
const replace = (pattern, substr) => str => str.replace(pattern, substr);
13+
const replace = (pattern, substr) => str => str.replace(pattern, substr)
1414

1515
// toLower :: String -> String
16-
const toLower = str => str.toLowerCase();
16+
const toLower = str => str.toLowerCase()
1717

1818
// append :: String -> String -> String
19-
const append = a => b => b.concat(a);
19+
const append = a => b => b.concat(a)
2020

21-
export {decode, compose, replace, toLower, append};
21+
export { decode, compose, replace, toLower, append }

rollup.config.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
const buble = require('rollup-plugin-buble');
2-
1+
const buble = require('rollup-plugin-buble')
32

43
module.exports = {
5-
entry: './index.js',
6-
moduleName: 'pullDomEvents',
7-
plugins: [
8-
buble()
9-
]
10-
};
4+
entry: './index.js',
5+
dest: 'dist/composable-normalize.js',
6+
moduleName: 'composableNormalize',
7+
format: 'umd',
8+
plugins: [
9+
buble()
10+
]
11+
}

0 commit comments

Comments
 (0)