npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

snoseeds-palindrome

v1.0.1

Published

Palindrome detector

Downloads

1

Readme

PalindromeTest object (with palindrome detector)

This is a sample NPM module created as a more elaborate form of an exercise from Learn Enough JavaScript to Be Dangerous. The module can be used as follows:

Arguments passed to PalindromeTest can be single string or multiple strings.

  • wordsPalindromeObject is a Map Object property of PalindromeTest that would give the same result irrespective of multiple string arguments or single string argument, because it's computed to show the Palindrome status of inputs on a word by word basis. It has also been computed not to return single alphabets as palindromes.
  • Whereas, phrasesPalindromeObject is a Map Object property of PlaindromeTest that's computed to return the palindrome status of inputs on an argument by argument basis or on every new line when string literals are used, it then processes each input phrases by phrases or sentences by sentences, while leaving words to be tested by wordsPalindromeObject).
  • It should also be noted that the palindrome status of a word or individual argument phrase appearing several times (irrespective of case and punctuation, and even irrespective of spaces between a string in the case of phrasesPalindromeObject) would only have its palindrome status showed once, and that's the last time that the word or phrase occurs.
  • palindromesOnlyObject is a Map Object property of PalindromeTest that's computed to only return all the Phrases and Words that have been tested to be palindromes.
  • Finally, other properties have been added, like passedPhrasesArray etc to allow for a more robust processing and intuitive presentation of the Palindrome Detector Result, an example of which is shown by a live palindrome tester that's hosted at Palindrome Tester, and its corresponding repository is at my GitHub repo.

$ npm install --global snoseeds-palindrome $ vim test.js let PalindromeTest = require("snoseeds-palindrome"); let napoleonsLament = new PalindromeTest("Able was I, ere I saw Elba", "Madam, I'm Adam", "Reconocer reconocer", "Obviously, it's not MALLAM.", "oBVIOUSLY, IT'S NOT MALLAM.", "A man, a plan, a canal-Panama"); napoleonsLament;
$ node test.js napoleonsLament PalindromeTest {
argumentsArray: [ 'Able was I, ere I saw Elba',
'Madam, I'm Adam',
'Reconocer reconocer',
'Obviously, it's not MALLAM.',
'oBVIOUSLY, IT'S NOT MALLAM.',
'A man, a plan, a canal-Panama' ],
UniquePhrasesObject: Map { 'ablewasiereisawelba' => 'Able was I, ere I saw Elba',
'madamimadam' => 'Madam, I'm Adam',
'reconocerreconocer' => 'Reconocer reconocer',
'obviouslyitsnotmallam' => 'oBVIOUSLY, IT'S NOT MALLAM.',
'amanaplanacanalpanama' => 'A man, a plan, a canal-Panama' }, phrasesArray: [ 'Able was I, ere I saw Elba',
'Madam, I'm Adam',
'Reconocer reconocer',
'oBVIOUSLY, IT'S NOT MALLAM.',
'A man, a plan, a canal-Panama' ], UniqueWordsObject: Map { 'able' => 'Able',
'was' => 'was',
'ere' => 'ere',
'saw' => 'saw',
'elba' => 'Elba',
'madam' => 'Madam',
'i'm' => 'I'm',
'adam' => 'Adam',
'reconocer' => 'reconocer',
'obviously' => 'oBVIOUSLY',
'it's' => 'IT'S',
'not' => 'NOT',
'mallam' => 'MALLAM',
'man' => 'man',
'plan' => 'plan',
'canal' => 'canal',
'panama' => 'Panama' },
wordsArray: [ 'Able',
'was',
'ere',
'saw',
'Elba',
'Madam',
'I'm',
'Adam',
'reconocer',
'oBVIOUSLY',
'IT'S',
'NOT',
'MALLAM',
'man',
'plan',
'canal',
'Panama' ], phrasesPalindromeObject: Map { 'ablewasiereisawelba' => true,
'madamimadam' => true,
'reconocerreconocer' => true,
'obviouslyitsnotmallam' => false,
'amanaplanacanalpanama' => true },
wordsPalindromeObject:
Map {
'able' => false,
'was' => false,
'ere' => true,
'saw' => false,
'elba' => false,
'madam' => true,
'i'm' => false,
'adam' => false,
'reconocer' => true,
'obviously' => false,
'it's' => false,
'not' => false,
'mallam' => true,
'man' => false,
'plan' => false,
'canal' => false,
'panama' => false },
palindromesOnlyObject:
Map {
'madamimadam' => true,
'reconocerreconocer' => true,
'amanaplanacanalpanama' => true,
'ere' => true,
'madam' => true,
'reconocer' => true,
'mallam' => true },
passedPhrasesPalindrome:
[ 'Madam, I'm Adam',
'Reconocer reconocer',
'A man, a plan, a canal-Panama' ],
passedWordsPalindrome: [ 'ere', 'Madam', 'reconocer', 'MALLAM' ],
formOfPassedPhrasesPalindrome: [ 'madamimadam', 'reconocerreconocer', 'amanaplanacanalpanama' ],
formOfPassedWordsPalindrome: [ 'ere', 'madam', 'reconocer', 'mallam' ] }