Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

@humanwhocodes/config-array 0.11.14

Glob-based configuration matching.
Package summary
Share
0
issues
0
licenses
Package created
25 Nov 2019
Version published
10 Jan 2024
Maintainers
1
Total deps
0
Direct deps
0
License
Apache-2.0
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does @humanwhocodes/config-array do?

The "@humanwhocodes/config-array" is a JavaScript package that manages configurations based on glob-pattern matching of filenames. Created by Nicholas C. Zakas, this package helps streamline the process of configuration that may get complicated over time. It is capable of representing all configurations, including overrides, by a single array where each item is a config object. Glob patterns within files and ignores properties from each config object are used to calculate a configuration for a given file.

How do you use @humanwhocodes/config-array?

To use the "@humanwhocodes/config-array", first, you need to install the package through either npm or Yarn:

npm install @humanwhocodes/config-array --save

or

yarn add @humanwhocodes/config-array

Then, you can import the ConfigArray constructor and create a new instance by passing in an array of configs and an options object:

import { ConfigArray } from "@humanwhocodes/config-array";

const configFilename = path.resolve(process.cwd(), "my.config.js");
const { default: rawConfigs } = await import(configFilename);

const configs = new ConfigArray(rawConfigs, {  
    basePath: process.cwd(),
    schema: mySchema
});

To normalize your configuration array before use, call the normalize() method and pass in a context object:

await configs.normalize({
    name: "MyApp"
});

You can use the getConfig() method on the normalized array and pass on the filename to get a config for:

const fileConfig = configs.getConfig(path.resolve(process.cwd(), "package.json"));

Where are the @humanwhocodes/config-array docs?

The "@humanwhocodes/config-array" doesn't have separate documentation. All information on how to use this package can be found directly in the readme file on its GitHub project page here. This includes examples of different ways for specifying schemas, determining ignored paths and employing caching mechanisms, etc., are all comprehensively contained in the readme.