is-even-is-odd is a lightweight utility package written in TypeScript to determine if a number is even or odd. It is designed to be simple, fast, and compatible with various JavaScript frameworks.
- Installation
- Usage
- API Reference
- Framework Integrations
- Advanced Usage
- Contribution Guide
- License
- FAQ
You can install is-even-is-odd
via npm or Yarn.
npm install is-even-is-odd
Using Yarn
```bash
yarn add is-even-is-odd
## Usage
### JavaScript
```javascript
const { isEven, isOdd } = require('is-even-is-odd');
console.log(isEven(2)); // true
console.log(isOdd(2)); // false
import { isEven, isOdd } from 'is-even-is-odd';
console.log(isEven(2)); // true
console.log(isOdd(2)); // false
Determines if a number is even.
-
num
- The number to check.
Returns true
if the number is even, false
otherwise.
Determines if a number is odd.
-
num
- The number to check.
Returns true
if the number is odd, false
otherwise.
import React from 'react';
import { isEven, isOdd } from 'is-even-is-odd';
const App = () => {
console.log(isEven(2)); // true
console.log(isOdd(2)); // false
return <div>Hello, world!</div>;
};
export default App;
<template>
<div>
{{ isEven(2) }} <!-- true -->
{{ isOdd(2) }} <!-- false -->
</div>
</template>
<script>
import { isEven, isOdd } from 'is-even-is-odd';
export default {
methods: {
isEven,
isOdd,
},
};
</script>
import { Component } from '@angular/core';
import { isEven, isOdd } from 'is-even-is-odd';
@Component({
selector: 'app-root',
template: `
<div>
{{ isEven(2) }} <!-- true -->
{{ isOdd(2) }} <!-- false -->
</div>
`,
})
export class AppComponent {
isEven = isEven;
isOdd = isOdd;
}
<script>
import { isEven, isOdd } from 'is-even-is-odd';
console.log(isEven(2)); // true
console.log(isOdd(2)); // false
</script>
<div>
Hello, world!
</div>
import { isEven, isOdd } from 'is-even-is-odd';
console.log(isEven(2)); // true
console.log(isOdd(2)); // false
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>is-even-is-odd</title>
</head>
<body>
<script type="module">
import { isEven, isOdd } from 'https://cdn.skypack.dev/is-even-is-odd';
console.log(isEven(2)); // true
console.log(isOdd(2)); // false
</script>
</body>
</html>
Please read the Contribution Guide to learn how you can contribute to this project.
This project is licensed under the MIT License.
is-even-is-odd
is a simple, fast, and lightweight utility package that allows you to determine if a number is even or odd. It is compatible with various JavaScript frameworks and can be used in both Node.js and the browser.
Please open an issue on the [GitHub repository](
# Output: README.md
# is-even-is-odd
**is-even-is-odd** is a lightweight utility package written in TypeScript to determine if a number is even or odd. It is designed to be simple, fast, and compatible with various JavaScript frameworks.
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [JavaScript](#javascript)
- [TypeScript](#typescript)
- [API Reference](#api-reference)
- [isEven](#isevennum-number-boolean)
- [isOdd](#isoddnum-number-boolean)
- [Framework Integrations](#framework-integrations)
- [React](#react)
- [Vue.js](#vuejs)
- [Angular](#angular)
- [Svelte](#svelte)
- [Advanced Usage](#advanced-usage)
- [Node.js](#nodejs)
- [Browser](#browser)
- [Contribution Guide](#contribution-guide)
- [License](#license)
- [FAQ](#faq)