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

is-even-is-odd

v1.0.1

Published

**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.

Downloads

121

Readme

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

You can install is-even-is-odd via npm or Yarn.

Using npm

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

TypeScript

import { isEven, isOdd } from 'is-even-is-odd';

console.log(isEven(2)); // true
console.log(isOdd(2)); // false

API Reference

isEven(num: number): boolean

Determines if a number is even.

  • num - The number to check.

Returns true if the number is even, false otherwise.

isOdd(num: number): boolean

Determines if a number is odd.

  • num - The number to check.

Returns true if the number is odd, false otherwise.

Framework Integrations

React

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;

Vue.js

<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>

Angular

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;
}

Svelte

<script>
  import { isEven, isOdd } from 'is-even-is-odd';

  console.log(isEven(2)); // true
  console.log(isOdd(2)); // false
</script>

<div>
  Hello, world!
</div>

Advanced Usage

Node.js

import { isEven, isOdd } from 'is-even-is-odd';

console.log(isEven(2)); // true
console.log(isOdd(2)); // false

Browser

<!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>

Contribution Guide

Please read the Contribution Guide to learn how you can contribute to this project.

License

This project is licensed under the MIT License.

FAQ

Why should I use is-even-is-odd?

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.

How can I report a bug or request a feature?

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)