JSPM

dynamikey

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • 0
    • Score
      100M100P100Q20546F
    • License MIT

    Dynamic Call in JavaScript!

    Package Exports

    • dynamikey
    • dynamikey/lib/index.js
    • dynamikey/lib/index.mjs

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dynamikey) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Dynamikey

    Dynamic Call in JavaScript!

    Example

    const dynamikey = new Dynamikey({})
        .add(/^plus-\d{1,10}$/, (path, params) => +path[0].substring(5) + params.reduce((a, b) => a + b, 0))
        .add(/^hello\.[^.]*?$/, (path, params) => `Hello ${params[1]}!`, "value")
        .gen();
    
    const plus_1000 = dynamikey["plus-1000"];
    console.log(plus_1000(1, 2, 3)); // 1006
    
    const plus_3000 = dynamikey["plus-3000"];
    console.log(plus_3000(-1, -2, -3)); // 2994
    
    const hello_world = dynamikey["hello.world"];
    console.log(hello_world); // Hello World!
    
    const hello_jacob = dynamikey["hello.jacob"];
    console.log(hello_jacob); // Hello Jacob!

    Features

    • Support Dynamic Call
    • Support Nested Call
    • Support Rirect Value Evaluation