An open API service indexing awesome lists of open source software.

https://github.com/psenger/palindrome

A simple Palindrome project with full test code coverage
https://github.com/psenger/palindrome

Last synced: 7 months ago
JSON representation

A simple Palindrome project with full test code coverage

Awesome Lists containing this project

README

          

# palindrome

A simple NodeJS v4.0.0 app written to test if a string is a Palindrome without reversing it. I used Mocha with BDD style tests, istanbul to validate code coverage, NPM to bump the version and create a release so it can linked into a node project with NPM, and used Travis CI for CI.

[![Build Status](https://travis-ci.org/psenger/palindrome.svg?branch=master)](https://travis-ci.org/psenger/palindrome)

## How to run the test

Install node js [here](https://nodejs.org/en/)
Install git [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

Then clone this project with git

```
git clone https://github.com/psenger/palindrome.git
```

then **cd** into the newly checked out directory

```
cd palindrome
```

and execute the following

```
npm install
npm test
```

The tests will run, and code coverage will be included in the output.

## Documentation

You can link this project directly into a NPM project via by using this package.json file. Replace xxxxxxxx with your Github Personal access tokens.

```js

"devDependencies": {
"palindrome": "git+https://xxxxxxxx:x-oauth-basic@github.com/psenger/palindrome.git",
}

```


## palindromic
This module contains variations of the Palindrome functions

**Author:** Philip A Senger

### palindromic.isPalindrome(aString) ⇒ boolean
Test if a string is a Palindrome

**Kind**: static method of [palindromic](#module_palindromic)
**Api**: public

| Param | Type | Description |
| --- | --- | --- |
| aString | string | The string value a Palindrome test, numbers, null, undefined, and functions will return false. |

**Example**
```js
if ( palindrome.isPalindrome ( "a toyotas a toyota" ) {
console.log( 'yes' );
}
```
**Example**
```js
if ( palindrome.isPalindrome ( "1221" ) {
console.log( 'yes' );
}
```
**Example**
```js
if ( palindrome.isPalindrome ( "abBA" ) {
console.log( 'yes' );
}
```