Skip to content

Commit d4fdba0

Browse files
🎨 style: Use default exports.
1 parent 97914bc commit d4fdba0

File tree

11 files changed

+57
-72
lines changed

11 files changed

+57
-72
lines changed

src/__code__.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import code from './code';
2+
const __code__ = (offset) => (string, index) => code(string, index, offset);
3+
export default __code__;

src/__lfill__.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default function __lfill__ ( c, n, mul ) {
2+
const f = mul( c, n );
3+
return ( s ) => ( f + s ).slice( -n );
4+
}

src/__rfill__.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default function __rfill__( c, n, mul ){
2+
const f = mul( c, n );
3+
return ( s ) => ( s + f ).slice( 0, n );
4+
}

src/code.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
1-
2-
3-
export function __code__ ( offset ) {
4-
5-
var code = function ( key, i ) {
6-
return key.charCodeAt( i ) - offset;
7-
};
8-
9-
return code;
10-
11-
}
12-
13-
1+
const code = (string, index, offset = 0) => string.charCodeAt(index) - offset;
2+
export default code;

src/concat.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {join} from './join';
2-
3-
export function concat ( strings ) {
4-
5-
return join( strings , '' ) ;
6-
7-
}
1+
import join from './join';
82

3+
const concat = (strings) => join(strings, '');
4+
export default concat;

src/fill.js

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

src/index.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
export * from './code' ;
2-
export * from './concat' ;
3-
export * from './fill' ;
4-
export * from './join' ;
5-
export * from './mul' ;
6-
export * from './palindrome' ;
7-
export * from './split' ;
1+
import __code__ from './__code__' ;
2+
import __lfill__ from './__lfill__' ;
3+
import __rfill__ from './__rfill__' ;
4+
import code from './code' ;
5+
import concat from './concat' ;
6+
import join from './join' ;
7+
import mul from './mul' ;
8+
import palindrome from './palindrome' ;
9+
import split from './split' ;
10+
11+
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
12+
export default {
13+
__code__ ,
14+
__lfill__ ,
15+
__rfill__ ,
16+
code ,
17+
concat ,
18+
join ,
19+
mul ,
20+
palindrome ,
21+
split ,
22+
} ;
23+
24+
export {
25+
__code__ ,
26+
__lfill__ ,
27+
__rfill__ ,
28+
code ,
29+
concat ,
30+
join ,
31+
mul ,
32+
palindrome ,
33+
split ,
34+
} ;

src/join.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
2-
export function join ( strings , sep ) {
3-
4-
return strings.join( sep ) ;
5-
6-
}
7-
1+
const join = (strings, sep) => strings.join(sep);
2+
export default join;

src/mul.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
import {concat} from './concat';
2-
3-
export function mul ( s, n ) {
4-
5-
var copies = new Array(n);
1+
import concat from './concat';
62

3+
export default function mul ( s, n ) {
4+
const copies = new Array(n);
75
while ( n-- ) copies[n] = s ;
8-
96
return concat( copies ) ;
107
}
11-

src/palindrome.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
2-
3-
export function palindrome ( s , i , j ) {
1+
export default function palindrome ( s , i , j ) {
42

53
while ( i < j ) if ( s[i++] !== s[--j] ) return false ;
64

75
return true ;
86

97
}
10-

0 commit comments

Comments
 (0)