0.0.5 • Published 10 months ago

palindromic v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Node.js build and publish package

Running Code Coverage

codecov npm.io

By extension, a palindrome is any series of elements with linear symmetry, that is, that have the same sequence of units in both directions.

Installation

Install with yarn or npm: yarn or npm:

# yarn
yarn add palindromic
# npm
npm i palindromic --save

Import the lib with es6 or cjs

// es6
import palindromic from 'palindromic';
// cjs
const palindromic = require('palindromic');

Usage examples

Helpers

findPalindromic
#!/usr/bin/env node
const { findPalindromic } = require("palindromic");

const is_palindromic = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99];
const not_palindromic = [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28];

const palindromic_list = findPalindromic([...is_palindromic, ...not_palindromic]);
console.log(palindromic_list); // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99]
isPalindromic
#!/usr/bin/env node
const { isPalindromic } = require("palindromic");

const is_palindromic = 77;
const not_palindromic = 13;

console.log(isPalindromic(is_palindromic)); // true
console.log(isPalindromic(not_palindromic)); // false

Utils

findPrimesNumbers
#!/usr/bin/env node
import { findPrimesNumbers, isPrimeNumber } from 'palindromic';

let primal_numbers: number[] = [];

for (let i = 1; i < 100; i++) {
    if (isPrimeNumber(i)) {
       primal_numbers.push(i);
    }
}
const result = findPrimesNumbers(primal_numbers);
console.log(result); // [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
isPrimeNumber
#!/usr/bin/env node
import {isPrimeNumber} from 'palindromic';

const is_prime_number = isPrimeNumber(7);
const not_prime_number = isPrimeNumber(8);

console.log(is_prime_number); // true
console.log(not_prime_number); // false

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Or buy me a coffee 🙌🏾

📝 License

Copyright © 2022 Hebert F Barros. This project is MIT licensed.

0.0.5

10 months ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago