@@ -23,6 +23,9 @@ Make sure to pass it big documents to get reliable results.
23
23
24
24
## Install
25
25
26
+ This package is [ ESM only] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
27
+ Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d.
28
+
26
29
[ npm] [ ] :
27
30
28
31
``` sh
@@ -40,8 +43,11 @@ available on [GitHub Releases][releases].
40
43
41
44
## Use
42
45
46
+ This package exports the following identifiers: ` franc ` , ` francAll ` .
47
+ There is no default export.
48
+
43
49
``` js
44
- var franc = require ( ' franc' )
50
+ import { franc , francAll } from ' franc'
45
51
46
52
franc (' Alle menslike wesens word vry' ) // => 'afr'
47
53
franc (' এটি একটি ভাষা একক IBM স্ক্রিপ্ট' ) // => 'ben'
@@ -57,47 +63,56 @@ franc('the', {minLength: 3}) // => 'sco'
57
63
###### ` .all `
58
64
59
65
``` js
60
- console .log (franc . all ( ' O Brasil caiu 26 posições ' ))
66
+ console .log (francAll ( ' Considerando ser essencial que os direitos humanos ' ))
61
67
```
62
68
63
69
Yields:
64
70
65
71
``` js
66
- [ [ ' por' , 1 ],
67
- [ ' src' , 0.8797557538750587 ],
68
- [ ' glg' , 0.8708313762329732 ],
69
- [ ' snn' , 0.8633161108501644 ],
70
- [ ' bos' , 0.8172851103804604 ],
71
- ... 116 more items ]
72
+ [
73
+ [ ' por' , 1 ],
74
+ [ ' glg' , 0.771284519307895 ],
75
+ [ ' spa' , 0.6034146900423971 ],
76
+ [ ' cat' , 0.5367251059928957 ],
77
+ [ ' src' , 0.47461899851037015 ],
78
+ ... 122 more items ]
72
79
```
73
80
74
81
###### ` only `
75
82
76
83
``` js
77
- console .log (franc .all (' O Brasil caiu 26 posições' , {only: [' por' , ' spa' ]}))
84
+ console .log (
85
+ francAll (' Considerando ser essencial que os direitos humanos' , {
86
+ only: [' por' , ' spa' ]
87
+ })
88
+ )
78
89
```
79
90
80
91
Yields:
81
92
82
93
``` js
83
- [ [ ' por' , 1 ], [ ' spa' , 0.799906059182715 ] ]
94
+ [ [ ' por' , 1 ], [ ' spa' , 0.6034146900423971 ] ]
84
95
```
85
96
86
97
###### ` ignore `
87
98
88
99
``` js
89
- console .log (franc .all (' O Brasil caiu 26 posições' , {ignore: [' src' , ' glg' ]}))
100
+ console .log (
101
+ francAll (' Considerando ser essencial que os direitos humanos' , {
102
+ ignore: [' src' , ' glg' ]
103
+ })
104
+ )
90
105
```
91
106
92
107
Yields:
93
108
94
109
``` js
95
110
[ [ ' por' , 1 ],
96
- [ ' snn ' , 0.8633161108501644 ],
97
- [ ' bos ' , 0.8172851103804604 ],
98
- [ ' hrv ' , 0.8107092531705026 ],
99
- [ ' lav ' , 0.810239549084077 ],
100
- ... 114 more items ]
111
+ [ ' spa ' , 0.6034146900423971 ],
112
+ [ ' cat ' , 0.5367251059928957 ],
113
+ [ ' ita ' , 0.4740460639394981 ],
114
+ [ ' fra ' , 0.44757648676521145 ],
115
+ ... 120 more items ]
101
116
```
102
117
103
118
## CLI
0 commit comments