open-index/open-npm huggingface dataset:
npm package: @rohitninawe/validation
Description: Validate the code.
Latest version: 0.0.8

# @rohitninawe/validation

[![npm (scoped)](https://img.shields.io/npm/v/@rohitninawe/validation.svg)](https://www.npmjs.com/package/@rohitninawe/validation)
[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/@rohitninawe/validation.svg)](https://www.npmjs.com/package/@rohitninawe/validation)

Validate the code as much as possible.

## Install
Using npm:

```shell
npm install @rohitninawe/validation
```

or using yarn:

```shell
yarn add @rohitninawe/validation
```

## Usage

```js
import { safeArray, isValidEmail } from '@rohitninawe/validation';
```
---

### safeArray()

If the parameter is not an array, safeArray() will return an empty array to prevent a crash, for instance when using the [.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) method.

#### Examples

```js
safeArray([2, 3, 4, "git", {"name": "John Smith"}])
// [2, 3, 4, "git", {"name": "John Smith"}]

safeArray("[1, 2, 3]")
// [1, 2, 3]

safeArray(undefined)
// []    

safeArray(123)
// []

safeArray("")
// []

```
#### Pro Tip

> If you're unsure whether a key or index exists, always use [optional chaining.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining)
> Example:

```
let response = null; // expected output => {"users": {"transaction":[]} };

let transaction = response.users.transaction;
//Uncaught TypeError: Cannot read properties of null (reading 'users')
transaction.map(item => item); //Error

//Using Optional Chaining 🤔👇
let transaction = response?.users?.transaction; //returns undefined
transaction.map(item => item);
//Uncaught TypeError: Cannot read properties of undefined (reading 'map')

//Optional Chaining + safeArray 😎
let transaction = response?.users?.transaction; //returns undefined
safeArray(transaction).map(item => item); //returns an empty array [].

```

### isValidEmail()

Checks the email's valid format

#### Examples

```js
isValidEmail("developer@gmail.com")
// true

isValidEmail("lorem ipsum")
// false

isValidEmail(""); //or any falsy value
// false

```
npm package: @rohitpal/nuxt
Description: A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)
Latest version: 0.9.11


<p align="center"><img align="center" src="http://imgur.com/V4LtoII.png"/></p>
<p align="center">
  <a href="https://travis-ci.org/nuxt/nuxt.js"><img src="https://img.shields.io/travis/nuxt/nuxt.js/master.svg" alt="Build Status"></a>
  <a href="https://ci.appveyor.com/project/Atinux/nuxt-js"><img src="https://ci.appveyor.com/api/projects/status/gwab06obc6srx9g4?svg=true" alt="Windows Build Status"></a>
  <a href="https://codecov.io/gh/nuxt/nuxt.js"><img src="https://img.shields.io/codecov/c/github/nuxt/nuxt.js/master.svg" alt="Coverage Status"></a>
  <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dt/nuxt.svg" alt="Downloads"></a>
  <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg" alt="Version"></a>
  <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/l/nuxt.svg" alt="License"></a>
  <a href="https://gitter.im/nuxt/nuxt.js"><img src="https://img.shields.io/badge/GITTER-join%20chat-green.svg" alt="Gitter"></a>
  <a href="https://donorbox.org/nuxt"><img src="https://img.shields.io/badge/Support%20us-donate-41B883.svg" alt="Support us"></a>

</p>
> Nuxt.js is a framework for server-rendered Vue applications (inspired by [Next.js](https://github.com/zeit/next.js))

## 🚧 Under active development, 1.0 will be released soon :fire:

## 🚧 Original repo https://github.com/nuxt/nuxt.js