<commit_before># Enter Checkout JS library

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## constructor

Initates a new Enter instance from artist Id.

**Parameters**

-   `artistId`  
-   `the` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Id of the artist for Enter.is

**Examples**

```javascript
enter = new EnterCheckout('5BzdSo4vrXQoYJnMw');
```

## init

Gathers product data from Enter.is

## productFromId

This function returns a product from it's Id.

**Parameters**

-   `id`  
-   `the` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Id of the product

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** a product found from the input id

## sortProducts

This function sorts the products item.

**Parameters**

-   `field` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name to sort by.
-   `order`  
-   `input` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** which order to sort by (optional, default `"asc"`)

## checkout

This function moves the user to a secure checkout link on Enter.is

## cartTotal

This function calculates the total price of the cart.

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the total price of the cart.

## addToCart

This function adds a product to cart

**Parameters**

-   `product`  
-   `the` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** product which is to be added to cart.

## updateCart

Manually updates cart object and the cart in local storage

**Parameters**

-   `cart`  
-   `the` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** new cart (array) of products to replace the current cart.

## clearCart

Completely clears the cart and updates local storage

## \_storeCart

Stores the cart in local storage for later use
<commit_msg>jsDoc example<commit_after># Enter Checkout JS library

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## constructor

Initates a new Enter instance from artist Id.

**Parameters**

-   `artistId`  
-   `the` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Id of the artist for Enter.is

**Examples**

```javascript
enter = new EnterCheckout('5BzdSo4vrXQoYJnMw');
```

## init

Gathers product data from Enter.is

**Examples**

```javascript
enter.init().then((res) => {
//do stuff with products
}).catch((reason) => {
console.log(reason);
});
```

## productFromId

This function returns a product from it's Id.

**Parameters**

-   `id`  
-   `the` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Id of the product

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** a product found from the input id

## sortProducts

This function sorts the products item.

**Parameters**

-   `field` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name to sort by.
-   `order`  
-   `input` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** which order to sort by (optional, default `"asc"`)

## checkout

This function moves the user to a secure checkout link on Enter.is

## cartTotal

This function calculates the total price of the cart.

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the total price of the cart.

## addToCart

This function adds a product to cart

**Parameters**

-   `product`  
-   `the` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** product which is to be added to cart.

## updateCart

Manually updates cart object and the cart in local storage

**Parameters**

-   `cart`  
-   `the` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** new cart (array) of products to replace the current cart.

## clearCart

Completely clears the cart and updates local storage

## \_storeCart

Stores the cart in local storage for later use

{'fraction_non_alphanumeric': 0.13873596124201718, 'fraction_numerical': 0.0008808632459810614, 'mean_word_length': 4.362455726092089, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, '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': '3150512', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1341, 'n_words': 394}