---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---

# Dictionary.prototype.get

:::info

This Class is deprecated, it has been renamed to [`ConfigStore`](pathname://../../../fastly%3Aconfig-store/ConfigStore/ConfigStore.mdx) and can be imported via `import { ConfigStore } from 'fastly:config-store'`

The `get()` method exists on the [`ConfigStore`](pathname://../../../fastly%3Aconfig-store/ConfigStore/ConfigStore.mdx) Class.

:::

The **`get()`** method returns the value associated with the provided key in the dictionary. If the provided key does not exist in the Dictionary then this returns `null`.

## Syntax

```js
get(key)
```

### Parameters

- `key` _: string_
  - The key to retrieve from the dictionary.

### Return value

A `string` representing the specified Dictionary value or `null` if the key does not exist in the Dictionary

## Description

Get a value for a key in the dictionary. If the provided key does not exist in the Dictionary then this returns `null`.

The `get()` method requires its `this` value to be a [`Dictionary`](../Dictionary.mdx) object.

If the `this` value does not inherit from `Dictionary.prototype`, a [`TypeError`](../../../globals/TypeError/TypeError.mdx) is thrown.

### Exceptions

- `TypeError`
  - Thrown if the provided key is longer than 255 in length
  - Thrown if the provided key is an empty string

## Examples

In this example we have an Edge Dictionary named "animals" and we return the "cat" entry as the response body to the client.

<Fiddle config={{
  "type": "javascript",
  "title": "Dictionary Example",
  "origins": [
    "https://http-me.fastly.dev"
  ],
  "src": {
    "deps": "{\n  \"@fastly/js-compute\": \"^1.0.1\"\n}",
    "main": `
/// <reference types="@fastly/js-compute" />
import { Dictionary } from "fastly:dictionary";
async function app (event) {
  const config = new Dictionary('animals');
  return new Response(config.get('cat'));
}
addEventListener("fetch", event => event.respondWith(app(event)));
`
  },
  "requests": [
    {
      "enableCluster": true,
      "enableShield": false,
      "enableWAF": false,
      "data": {
         "dictionaries": {
           "animals": {
             "cat": "meow"
           }
         }
       },
      "method": "GET",
      "path": "/status=200",
      "useFreshCache": false,
      "followRedirects": false,
      "tests": "",
      "delay": 0
    }
  ],
  "srcVersion": 1
}}>

```js
/// <reference types="@fastly/js-compute" />
import { Dictionary } from "fastly:dictionary";
async function app (event) {
  const config = new Dictionary('animals');
  return new Response(config.get('cat'));
}
addEventListener("fetch", event => event.respondWith(app(event)));
```

</Fiddle>
