【文件属性】:
文件名称:unique-words:返回字符串或数组中的唯一单词
文件大小:8KB
文件格式:ZIP
更新时间:2021-04-30 22:06:13
javascript language string array words
唯一词
返回唯一单词的数组,或者字符串或列表中每个单词的出现次数。
请考虑关注该项目的作者 ,并考虑为该项目以显示您的 :red_heart: 和支持。
安装
使用安装:
$ npm install --save unique-words
用法
const unique = require ( 'unique-words' ) ;
console . log ( unique ( 'one two one two three' ) ) ;
// => ['one', 'two', 'three']
console . log ( unique ( [ 'foo' , 'foo' , 'foo bar' , 'bar' , 'bar baz foo' ] ) ) ;
// => ['foo', 'bar', 'baz']
.counts
公开了一个.counts()方法,用于获取每个单词的出现次数。
【文件预览】:
unique-words-master
----.gitignore(302B)
----README.md(3KB)
----.verb.md(586B)
----LICENSE(1KB)
----.gitattributes(157B)
----package.json(959B)
----index.js(476B)
----test.js(4KB)
----.travis.yml(95B)
----.editorconfig(289B)
----.eslintrc.json(4KB)
----.npmrc(19B)