Skip to content

Commit c5e50bf

Browse files
authored
Refactor tests and make it easier (#13)
1 parent 8406e8e commit c5e50bf

12 files changed

+3745
-6949
lines changed

karma.conf.js

-106
This file was deleted.

lib/src/emojis.ts lib/emojis.ts

File renamed without changes.

lib/index.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import Ecoji from './src/Ecoji'
2-
import emoji from './src/emojis'
3-
/* tslint:disable-next-line:no-unused-expression */
4-
import './src/ext'
5-
import Mapping from './src/Mapping'
1+
import emojis from './emojis'
2+
import { Ecoji, Mapping } from './src'
63

7-
export = new Ecoji(new Mapping(emoji))
4+
export = new Ecoji(new Mapping(emojis))

lib/src/ext/index.ts

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
declare global {
2+
/* tslint:disable-next-line:interface-name */
3+
interface String {
4+
mb_length(): number
5+
6+
mb_substr(from: number, length?: number): string
7+
8+
mb_split(): string[]
9+
10+
has_emoji(): boolean
11+
12+
encode(): string
13+
14+
decode(): string
15+
}
16+
}
17+
118
String.prototype.mb_split = function(): string[] {
219
return Array.from(this.split('\u{200D}')[0].split(/[\ufe00-\ufe0f]/).join(''))
320
}
@@ -21,3 +38,5 @@ String.prototype.decode = function(): string {
2138
return this.toString()
2239
}
2340
}
41+
42+
export default String.prototype

lib/src/ext/string.ext.ts

-14
This file was deleted.

lib/src/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import './ext'
2+
3+
import Ecoji from './Ecoji'
4+
import Mapping from './Mapping'
5+
6+
export { Ecoji, Mapping }

0 commit comments

Comments
 (0)