Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bjarneo/find-anagrams
This package will find all anagrams from an array and group them together in an matrix array
https://github.com/bjarneo/find-anagrams
anagrams angram find-anagrams scrabble words
Last synced: 3 days ago
JSON representation
This package will find all anagrams from an array and group them together in an matrix array
- Host: GitHub
- URL: https://github.com/bjarneo/find-anagrams
- Owner: bjarneo
- License: mit
- Created: 2017-12-05T09:08:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-06T06:17:34.000Z (almost 7 years ago)
- Last Synced: 2024-11-07T09:09:22.646Z (6 days ago)
- Topics: anagrams, angram, find-anagrams, scrabble, words
- Language: JavaScript
- Size: 41 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
find anagrams
======
![Travis](https://travis-ci.org/bjarneo/find-anagrams.svg?branch=master)What is this?
------
This package will find all anagrams from an array and group them together in an matrix array. It will discard words without an anagram. https://en.wikipedia.org/wiki/AnagramInstallation
------
It's available on npm.
```
npm install --save find-anagrams
```Usage
------
Find all words that are anagrams in an array
```js
const findAnagrams = require('find-anagrams');findAnagrams([
'listen',
'silent',
'enlist',
'word',
'dog',
'god',
'server',
'revers'
]);/*
[
[ 'listen', 'silent', 'enlist' ],
[ 'dog', 'god' ],
[ 'server', 'revers' ]
]
*/
```Find all words that are anagrams to provided word
```js
const findAnagrams = require('find-anagrams');const words = [
'listen',
'silent',
'enlist',
'word',
'dog',
'god',
'server',
'revers'
];findAnagrams(words, 'silent');
/*
The provided word will be the first in the array[ 'silent', 'listen', 'enlist' ]
*/
```Test
------
```bash
$ npm test
```Contribution
------
Contributions are appreciated.License
------
MIT licensed. See LICENSE.