<commit_before># NGX Cookie Service

<p align="center">

![build](https://github.com/stevermeister/ngx-cookie-service/workflows/CI/badge.svg?branch=master)
<a href="https://www.npmjs.com/ngx-cookie-service">
<img src="https://img.shields.io/npm/v/ngx-cookie-service.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Ngx Cookie Service on npm" />
</a>
<a href="https://gitter.im/ngx-cookie-service/community">
<img src="https://badges.gitter.im/ngx-cookie-service/community.svg" alt="Chat in Gitter" />
</a>
[![ngx-cookie-service channel on discord](https://img.shields.io/discord/873021904708059177.svg?style=flat-square)](https://discord.gg/N3xc4Jfb)

</p>

Angular service to read, set and delete browser cookies. Originally based on the [ng2-cookies](https://www.npmjs.com/package/ng2-cookies) library. The experienced team behind [Studytube](https://www.studytube.nl/) will take care of our cookie service from now on.

# Installation

```bash
npm install ngx-cookie-service --save

# or

yarn add ngx-cookie-service
```

Add the cookie service to your `app.module.ts` as a provider:

```typescript
import { CookieService } from 'ngx-cookie-service';

@NgModule({
  ...
    providers:
[CookieService],
...
})

export class AppModule {
}
```

Then, import and inject it into a constructor:

```typescript
constructor(private
cookieService: CookieService
)
{
  this.cookieService.set('Test', 'Hello World');
  this.cookieValue = this.cookieService.get('Test');
}
```

That's it!

## Demo
https://stackblitz.com/edit/angular-ivy-1lrgdt?file=src%2Fapp%2Fapp.component.ts

## Supported Versions

For Angular 9.0.0+ use latest version of the library. For versions < 9.x.x, use 2.3.0 version

| Angular Version | Supported Version |
| --------------- | ----------------- |
| 9.0.0+          | latest            |
| < 9.0.0         | 2.3.0             |

# API

## check( name: string ): boolean;

```typescript
const cookieExists: boolean = cookieService.check('test');
```

Checks if a cookie with the given`name` can be accessed or found.
<commit_msg>docs: updates README.md with new Supported Versions section<commit_after># NGX Cookie Service

<p align="center">

![build](https://github.com/stevermeister/ngx-cookie-service/workflows/CI/badge.svg?branch=master)
<a href="https://www.npmjs.com/ngx-cookie-service">
<img src="https://img.shields.io/npm/v/ngx-cookie-service.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Ngx Cookie Service on npm" />
</a>
<a href="https://gitter.im/ngx-cookie-service/community">
<img src="https://badges.gitter.im/ngx-cookie-service/community.svg" alt="Chat in Gitter" />
</a>
[![ngx-cookie-service channel on discord](https://img.shields.io/discord/873021904708059177.svg?style=flat-square)](https://discord.gg/N3xc4Jfb)

</p>

Angular service to read, set and delete browser cookies. Originally based on the [ng2-cookies](https://www.npmjs.com/package/ng2-cookies) library. The experienced team behind [Studytube](https://www.studytube.nl/) will take care of our cookie service from now on.

# Installation

```bash
npm install ngx-cookie-service --save

# or

yarn add ngx-cookie-service
```

Add the cookie service to your `app.module.ts` as a provider:

```typescript
import { CookieService } from 'ngx-cookie-service';

@NgModule({
  ...
    providers:
[CookieService],
...
})

export class AppModule {
}
```

Then, import and inject it into a constructor:

```typescript
constructor(private
cookieService: CookieService
)
{
  this.cookieService.set('Test', 'Hello World');
  this.cookieValue = this.cookieService.get('Test');
}
```

That's it!

## Demo
https://stackblitz.com/edit/angular-ivy-1lrgdt?file=src%2Fapp%2Fapp.component.ts

## Supported Versions

For Angular 13.x.x or later use the latest version of the library. For versions <12.x.x, use 12.0.3 version

| Angular Version | Supported Version |
| --------------- | ----------------- |
| 13.0.0+          | latest            |
| < 12.2.x        | 12.0.3             |

# API

## check( name: string ): boolean;

```typescript
const cookieExists: boolean = cookieService.check('test');
```

Checks if a cookie with the given`name` can be accessed or found.

{'fraction_non_alphanumeric': 0.1684938036224976, 'fraction_numerical': 0.020257387988560534, 'mean_word_length': 3.835253456221198, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, 'https://': 20, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '387997', 'n_tokens_mistral': 1519, 'n_tokens_neox': 1419, 'n_words': 328}