
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
luxon-jsonata
Advanced tools
A suite of functions implementing the Luxon API for use in JSONata expressions
JSONata bindings for the Luxon date library.
JSONata is a great tool for transforming JSON data, but the date and time manipulation functions that it provides
are lacklustre. This package adds a simple binding for Luxon's DateTime
, Duration
and Interval
objects so they can be
used directly in JSONata expressions.
import addLuxon from "luxon-jsonata";
import jsonata from "jsonata";
const expr = jsonata(
'$Duration.fromISO("P2M").plus({"months":3, "days":10}).toISO()'
);
addLuxon(expr);
console.log(expr.evaluate({}));
// Result is "P5M10D"
Not all methods are going to work. In particular, methods that themselves take functions, or require a standard Date object are a bit awkward to use in JSONata. Perhaps in future we can dynamically remove these from the bound objects.
For Luxon member functions that themselves take functions, like Duration.mapUnits
, you can assign a Javascript
function to the expression that takes the object and performs the operation you need:
const double = (x: Duration) => x.mapUnits((u) => u * 2);
const expr = jsonata(
"$double($Duration.fromObject({ 'hours': 1, 'minutes': 30 })).toObject()"
);
addLuxon(expr);
expr.assign("double", double);
console.log(expr.evaluate({}));
// Result is { hours: 2, minutes: 60 }
This package is supported by SaaSquatch.
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
Simple Luxon object bindings for JSONata
The npm package luxon-jsonata receives a total of 66 weekly downloads. As such, luxon-jsonata popularity was classified as not popular.
We found that luxon-jsonata demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.