open-index/open-npm huggingface dataset:
npm package: @suchipi/femver
Description: Lightweight alternative to semver, supporting absolute versions only
Author: Lily Scott
Latest version: 1.0.0

# @suchipi/femver

> Lightweight alternative to semver, supporting absolute versions only

The [semver npm package](https://www.npmjs.com/package/semver) is big, weighing in at 88.2 kB (with one dependency, weighing 53.9 kB).

It's big because it has a lot of features, like:

- Matching versions against ranges and patterns
- Coercing vague versions into semver strings
- Identifying the minimum/maximum version of a range
- Cleaning version-like strings into semver strings

These features are great; they're what power npm and let us specify version ranges in our `package.json`s.

However, if you only need to compare two version strings, like so:

```js
const semver = require("semver");

semver.gte(process.version, "8.0.0");
```

Then pulling in all of semver is a little unnecessary.

That's where `@suchipi/femver` comes in; it's a lightweight alternative to `semver`, which _only_ supports comparing absolute versions (eg `1.2.0`, not `>= 1.0.0`).

## API

```ts
/**
 * Reports whether `version` is a valid (absolute) semantic version string.
 */
export function isValid(version: string): boolean;

/**
 * Parses `version` into an object containing major, minor, and patch properties.
 */
export function parse(version: string): {
  major: number;
  minor: number;
  patch: number;
};

/**
 * Returns whether `firstVersion` is less than `secondVersion`.
 */
export function lt(firstVersion: string, secondVersion: string): boolean;

/**
 * Returns whether `firstVersion` is less than or equal to `secondVersion`.
 */
export function lte(firstVersion: string, secondVersion: string): boolean;

/**
 * Returns whether `firstVersion` is greater than `secondVersion`.
 */
export function gt(firstVersion: string, secondVersion: string): boolean;

/**
 * Returns whether `firstVersion` is greater than or equal to `secondVersion`.
 */
export function gte(firstVersion: string, secondVersion: string): boolean;

/**
 * Returns whether `firstVersion` is equal to `secondVersion`.
 */
export function eq(firstVersion: string, secondVersion: string): boolean;
```

## Example

```js
const femver = require("@suchipi/femver");
// or:
// import * as femver from "@suchipi/femver";

femver.gte(process.version, "8.0.0");
```

## License

MIT
npm package: @suchipi/game-controller
Description: Wrapper around the Web [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API) that reduces the amount of boilerplate required to support Gamepads in your application.
Latest version: 0.0.5

# `@suchipi/game-controller`

Wrapper around the Web [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API) that reduces the amount of boilerplate required to support Gamepads in your application.

## Usage

```js
import GameController from "@suchipi/game-controller";

const player1 = new GameController();
// Or, to get a different controller index:
const player2 = new GameController({ id: 1 /* (defaults to 0) */ });

// To listen to buttons going from unpressed to pressed:
player1.addEventListener("buttondown", (name) => {
  console.log(`${name} pressed`);
});

// To listen to buttons going from pressed to unpressed:
player1.addEventListener("buttonup", (name) => {
  console.log(`${name} released`);
});

// To listen to the left analog stick moving around:
player1.addEventListener("leftanalogchange", ({ x, y }) => {
  console.log(`left analog: ${(x, y)}`);
});

// To listen to the right analog stick moving around:
player1.addEventListener("rightanalogchange", ({ x, y }) => {
  console.log(`right analog: ${(x, y)}`);
});

// Or, instead of listening to events, you can read player1.state in your own loop:
console.log(player1.state);
// {
//   "leftStick": {
//     "x": 0,
//     "y": 0
//   },
//   "rightStick": {
//     "x": 0,
//     "y": 0
//   },
//   "pressed": {
//     "cross": false,
//     "circle": false,
//     "square": false,
//     "triangle": false,
//     "l1": false,
//     "r1": false,
//     "l2": false,
//     "r2": false,
//     "select": false,
//     "start": false,
//     "l3": false,
//     "r3": false,
//     "up": false,
//     "down": false,
//     "left": false,
//     "right": false,
//     "ps": false
//   }
// }
```

By default it uses PS3 controller button names regardless of your actual controller, but you can use different button names by specifying them when you construct your `GameController` instance:

```js
const controller = new GameController({
  buttonNames: GameController.BUTTON_NAMES.XBOX,
  // or GameController.BUTTON_NAMES.NINTENDO, or your own array of strings
});
```

## API Documentation

Please see the included [TypeScript types](https://github.com/suchipi/suchipi-game-controller/blob/main/src/index.d.ts) for API documentation.

## License

MIT