📅  最后修改于: 2023-12-03 15:13:19.516000             🧑  作者: Mango
Anagram js is a lightweight library for Node.js and the browser that allows you to find anagrams of a given word. An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
You can install Anagram js using npm:
npm install anagram-js
Or you can include it directly in your website using a script tag:
<script src="https://unpkg.com/anagram-js"></script>
const anagram = require('anagram-js');
const results = anagram('test', ['tset', 'estt', 'set']);
console.log(results); // ['tset', 'estt']
The anagram
function takes two arguments: a word to find anagrams for, and an array of words to search for anagrams in. It returns an array of strings that are anagrams of the input word.
If you would like to contribute to Anagram js, please feel free to open a pull request or submit an issue on the GitHub repository.
Anagram js is licensed under the MIT License.