This repository was archived by the owner on Dec 12, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +12
-37
lines changed Expand file tree Collapse file tree 6 files changed +12
-37
lines changed Original file line number Diff line number Diff line change 1
1
# file2html
2
+ [ ![ Build Status] ( https://secure.travis-ci.org/file2html/file2html.png?branch=master )] ( https://travis-ci.org/file2html/file2html )
3
+ [ ![ npm] ( https://img.shields.io/npm/dm/file2html.svg )] ( https://www.npmjs.com/package/file2html )
4
+ [ ![ npm] ( https://img.shields.io/npm/v/file2html.svg )] ( https://www.npmjs.com/package/file2html )
5
+ [ ![ npm] ( https://img.shields.io/npm/l/file2html.svg )] ( https://www.npmjs.com/package/file2html )
6
+ [ ![ Coverage Status] ( https://coveralls.io/repos/github/file2html/file2html/badge.svg?branch=master )] ( https://coveralls.io/github/file2html/file2html?branch=master )
7
+
2
8
> JS convertor of files to HTML and CSS code
3
9
4
10
## Requirements
Original file line number Diff line number Diff line change 1
1
export declare function lookup ( filename : string ) : string ;
2
- export declare function isSupportedExtension ( extension : string ) : boolean ;
3
- export declare function isSupportedMimeType ( mimeType : string ) : boolean ;
Original file line number Diff line number Diff line change @@ -11,26 +11,12 @@ var mimeTypes = {
11
11
txt : 'text/plain' ,
12
12
docx : 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ,
13
13
fb : 'application/x-fictionbook+xml' ,
14
- fb2 : 'application/x-fictionbook+xml'
14
+ fb2 : 'application/x-fictionbook+xml' ,
15
+ odt : 'application/vnd.oasis.opendocument.text'
15
16
} ;
16
17
function lookup ( filename ) {
17
18
var name = filename . toLowerCase ( ) ;
18
19
var extension = name . split ( '.' ) . pop ( ) ;
19
20
return mimeTypes [ extension ] ;
20
21
}
21
22
exports . lookup = lookup ;
22
- function isSupportedExtension ( extension ) {
23
- return Boolean ( mimeTypes [ extension . replace ( / ^ \. / , '' ) ] ) ;
24
- }
25
- exports . isSupportedExtension = isSupportedExtension ;
26
- function isSupportedMimeType ( mimeType ) {
27
- for ( var extension in mimeTypes ) {
28
- if ( mimeTypes . hasOwnProperty ( extension ) ) {
29
- if ( mimeType === mimeTypes [ extension ] ) {
30
- return true ;
31
- }
32
- }
33
- }
34
- return false ;
35
- }
36
- exports . isSupportedMimeType = isSupportedMimeType ;
Original file line number Diff line number Diff line change 5
5
* @param {TextEncoding.TextDecodeOptions } [options]
6
6
* @returns {string }
7
7
*/
8
- export declare function decode ( content : Uint8Array , encoding ?: string , options ?: TextEncoding . TextDecodeOptions ) : string ;
8
+ export declare function decode ( content : Uint8Array , encoding ?: string , options ?: TextEncoding . TextDecoderOptions ) : string ;
9
9
export declare function encode ( text : string , encoding ?: string , options ?: TextEncoding . TextEncoderOptions ) : Uint8Array ;
Original file line number Diff line number Diff line change @@ -9,28 +9,13 @@ const mimeTypes: {[key: string]: string} = {
9
9
txt : 'text/plain' ,
10
10
docx : 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ,
11
11
fb : 'application/x-fictionbook+xml' ,
12
- fb2 : 'application/x-fictionbook+xml'
12
+ fb2 : 'application/x-fictionbook+xml' ,
13
+ odt : 'application/vnd.oasis.opendocument.text'
13
14
} ;
14
15
15
16
export function lookup ( filename : string ) {
16
17
const name : string = filename . toLowerCase ( ) ;
17
18
const extension : string = name . split ( '.' ) . pop ( ) ;
18
19
19
20
return mimeTypes [ extension ] ;
20
- }
21
-
22
- export function isSupportedExtension ( extension : string ) : boolean {
23
- return Boolean ( mimeTypes [ extension . replace ( / ^ \. / , '' ) ] ) ;
24
- }
25
-
26
- export function isSupportedMimeType ( mimeType : string ) : boolean {
27
- for ( const extension in mimeTypes ) {
28
- if ( mimeTypes . hasOwnProperty ( extension ) ) {
29
- if ( mimeType === mimeTypes [ extension ] ) {
30
- return true ;
31
- }
32
- }
33
- }
34
-
35
- return false ;
36
21
}
Original file line number Diff line number Diff line change 4
4
* @param {TextEncoding.TextDecodeOptions } [options]
5
5
* @returns {string }
6
6
*/
7
- export function decode ( content : Uint8Array , encoding ?: string , options ?: TextEncoding . TextDecodeOptions ) : string {
7
+ export function decode ( content : Uint8Array , encoding ?: string , options ?: TextEncoding . TextDecoderOptions ) : string {
8
8
return new TextDecoder ( encoding , options ) . decode ( content ) ;
9
9
}
10
10
You can’t perform that action at this time.
0 commit comments