
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Interpolate values from a shared context into a string template (or another object).
Substitutes sections of a string marked with `` by evaluating contents. As a convenience, the values can be referenced from a context object.
Used by seneca-msg-test to support back references to earlier test results.
const Inks = require('inks')
var out = Inks('`foo:bar`', {foo:{bar:'zed'}})
// out === 'zed'
out = Inks({deep:'`foo:bar`'}, {foo:{bar:'zed'}})
// out === {deep:'zed'}
out = Inks({deep:'`$.foo`'}, {foo:{bar:'zed'}})
// out === {deep:{bar:'zed'}}
Another example, where $
references the context object.
const context = { red: { foo: 1, bar: 'zed'}, green: { fizz: { buzz: 'FRED' }} }
const template = 'Lorem `red:foo` ipsum `$.red.foo + $.red.bar.length` dolor `green:fizz.buzz` sit \\` amet.'
const result = Inks(template, context)
// prints:
// Lorem 1 ipsum 4 dolor FRED sit ` amet.
key:dot-path
.<js-expression>
where $ === context
.red:foo
-> 1
not '1'
.JSON.stringify
.Copyright (c) 2018, Richard Rodger and other contributors. Licensed under MIT.
FAQs
Interpolate values from a shared context into a string template.
The npm package inks receives a total of 249 weekly downloads. As such, inks popularity was classified as not popular.
We found that inks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.