File size: 907 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Create Calypso Config

This package exports a single function which takes config data and returns the config object used around Calypso.

This was extracted from `lib/create-config`.

## ConfigApi interface

The API returned by `createConfig` is as follows. It is a function extended with a handful of useful features-oriented functions.

### config( key )

Returns the value for the given configuration key.

```js
const value = config( key );
```

### config.isEnabled( key )

Is a feature enabled?

```js
if ( config.isEnabled( 'myFeature' ) ) {
	// do something only when myFeature is enabled
}
```

### config.enabledFeatures()

Gets the list of enabled features.

```js
const enabledFeatures = config.enabledFeatures();
```

### config.enable( key )

Enable a feature.

```js
config.enable( 'myFeature' );
```

### config.disable( key )

Disable a feature.

```js
config.disable( 'myFeature' );
```