New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

overloadfig

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

overloadfig

overloadable config values. Simplifies writing defaults for configs

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Overloadfig 🤯

Config Descriptors.

  • Easy to use
  • Loose Goosey
  • Json

Examples

Don't believe me? take a look at this stuff ripped out of example.js:

// Example overloadfig
const exampleSpec = {
    "action": {
        "string": (val) => {
            console.log("hello " + val);
        },
        "number": (val) => {
            console.log("number: " + val);
        },
        "object": {
            "http": (val) => {
                console.log("making a http get! (not really obviously)" );
                return "abc"; // Could return the actual value here
            },
        },
    },
    "msg": { // Note don't have to specify that it's an object
        "name": (name) => {
            console.log(`hello ${name}!`);
            return `hello ${name}!`;
        }
    },
}

// Basic callbacks on values
loadConfig(exampleSpec, {
    "action": "to new overloadfig user!",
    "msg": {
        "name": "root"
    }
});
// Outputs ->
//     hello to new overloadfig user!
//     hello root!



// Return values
// Also all keys are optional, best effort approach with minimal erroring
console.log(loadConfig(exampleSpec, {
    "action": {
        "http": "asdf"
    },
}));
// Outputs ->
//     making a http get! (not really obviously)
//     { action: { http: 'abc' } }

FUTURE WORK

  • Strict mode
  • Typescript

Keywords

overloadable

FAQs

Package last updated on 31 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts