
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
expression-expander
Advanced tools
Expands \${to be evaluated} expressions in object graphs. The actual expression syntax inside of the \${evaluated} is not defined within this module (only simple key lookup)
import { createContext } from "expression-expander";
const context = createContext();
context.properties = { aKey: "aValue", moreKeys: { a: 1, b: 2 } };
// expanding whole expressions at the key position
console.log(
JSON.stringify(
context.expand({ simple: "${aKey}", complex: { "${moreKeys}": {} } })
)
);
Output
{ "simple": "aValue", "complex": { "a": 1, "b": 2 } }
Type: Function
Returns Object expression evaluation result
Type: Object
value
Object Type: Function
value
string to be quotedReturns string quoted value
Type: Function
Returns (string | boolean | number | bigint | Object | Map | Set) expression evaluation result
Type: Object
Creates a new expansion context
options
Object? object with the following keys
options.leftMarker
string? lead in of expressionoptions.rightMarker
string? lead out of expressionoptions.markerRegexp
(RegExp | string)? expression with lead in / outoptions.valueQuoter
Quoter? to quote expanded values
by default no special quoting is done and the evaluated result will be direcly
inserted into the output stringoptions.evaluate
Evaluator? evaluate(expression,context,path) function to evaluate expressions
the default evaluation function does a lookup into the propertiesoptions.keepUndefinedValues
boolean? true: is expression resolves to undefind the original string will be used (with surrounding ${})options.maxNestingLevel
number? max number of recursive calls to expand defaults to 20options.properties
Object? default properties to evaluate expression againstReturns ExpressionExpander newly created expansion context
Type: Expander
object
path
(optional, default [{value:object}]
)Properties used for the default expander implementation
With npm do:
npm install expression-expander
BSD-2-Clause
FAQs
expands expressions in object graphs
We found that expression-expander 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.