open-index/open-npm huggingface dataset:
npm package: @seiry/isomorphic-unfetch
Description: Switches between unfetch & node-fetch for client & server.
Latest version: 3.0.0

# Isomorphic Unfetch

Switches between [unfetch](https://github.com/developit/unfetch) & [node-fetch](https://github.com/bitinn/node-fetch) for client & server.

## Install

This project uses [node](http://nodejs.org) and [npm](https://npmjs.com). Go check them out if you don't have them locally installed.

```sh
$ npm i isomorphic-unfetch
```

Then with a module bundler like [rollup](http://rollupjs.org/) or [webpack](https://webpack.js.org/), use as you would anything else:

```javascript
// using ES6 modules
import fetch from 'isomorphic-unfetch'

// using CommonJS modules
const fetch = require('isomorphic-unfetch')
```

## Usage

As a [**ponyfill**](https://ponyfill.com):

```js
import fetch from 'isomorphic-unfetch';

fetch('/foo.json')
  .then( r => r.json() )
  .then( data => {
    console.log(data);
  });
```

Globally, as a [**polyfill**](https://ponyfill.com/#polyfill):

```js
import 'isomorphic-unfetch';

// "fetch" is now installed globally if it wasn't already available

fetch('/foo.json')
  .then( r => r.json() )
  .then( data => {
    console.log(data);
  });
```

## License

[MIT License](LICENSE.md) © [Jason Miller](https://jasonformat.com/)
npm package: @seishinverse/crypto
Description: Compact and fast crypto module for hashing and comparing hashes
Latest version: 1.0.0

# Crypto

Compact and fast crypto module for hashing and comparing hashes

#### Installation

```sh
npm i @seishinverse/crypto

# or with yarn
yarn add @seishinverse/crypto

# or with pnpm
pnpm i @seishinverse/crypto
```

#### Example of usage for NestJS

In first import `CryptoModule` in `AppModule`.

```typescript
import { CryptoModule } from '@seishinverse/crypto';
import { Module } from '@nestjs/common';

@Module({
  imports: [CryptoModule.forRoot()],
})
export class AppModule {}
```

Then inject service with decorator `InjectCrypto`.

```typescript
import { CryptoModule, InjectCrypto, CryptoService } from '@seishinverse/crypto';
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
  constructor(@InjectCrypto() private cryptoService: CryptoService) {}

  /*
    Generating salt and hashing password.
  */
  signUp() {
    const SALT_ROUNDS = 5;
    const hashSalt = this.cryptoService.genSalt(SALT_ROUNDS);
    const hashedPassword = this.cryptoService.hash('very secret pass!', hashSalt);
    // ...
  }

  /*
    Comparing current password with incoming.
  */
  signIn() {
    const currentPassword = 'very secret pass!';
    const incomingPassword = 'not secret pass:(';

    const isPasswordEqual = this.cryptoService.compare(incomingPassword, currentPassword);

    console.log(isPasswordEqual); // false
  }
}
```

#### Example of usage in NodeJS

Import `CryptoService` and initialize it.

```typescript
import { CryptoService } from '@seishinverse/crypto';

const cryptoService = new CryptoService();

/*
  Generating salt and hashing password.
*/
const SALT_ROUNDS = 5;
const hashSalt = this.cryptoService.genSalt(SALT_ROUNDS);
const hashedPassword = this.cryptoService.hash('very secret pass!', hashSalt);
/*
  Comparing current password with incoming.
*/
const currentPassword = hashedPassword;
const incomingPassword = 'not secret pass:(';

const isPasswordEqual = this.cryptoService.compare(incomingPassword, currentPassword);

console.log(isPasswordEqual); // false
```