
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
IMO javascript's saving grace is its built in asynchronousity with the ability to pass around functions.
get('something', function doThisAfterGettingSomething(data) {
// Do stuff with data
});
but this creates a stylistic problem:
get('something', function(data) {
var values = map(data, function(item) {
return map(item.posts, function(otherItem) {
return // finally return the thing you wanted
});
});
// do something with values
});
This is also commonly referred to as callback hell. http://callbackhell.com
What if there was a way to simplify logical predicates?
get('posts', function(posts) {
var stickyPosts = _.select(posts, premise('sticky'));
});
But wait there's more!
You can do use any javascript operator sequence
|| && + - / * < > <= >= == !=
var recentPosts = _.select(posts, premise('pinned').or('timestamp').gt(new Date('2016-1-1')))
// Say you have a date range filter
var visiblePosts = _.select(posts, premise('date').gt(startDate).or('date').lt(endDate));
// Maybe you want to translate values
var percentages = _.map([ 0.3213, 0.5123, 0.7735 ], premise.mul(100));
//=> [32.13, 51.23, 77.35]
var sortedPostsPremise = premise('selected').and(premise('pinned').or('date'));
// logically equivalent to function(obj) { return obj.selected && (obj.pinned || obj.date) }
predicate(attribute)
predicate returns a matcher object, on which you can call any of the chain functions and, or, gt, lt, gte, lte, eq, ne, add, sub, mult, div, strictEq, strictNeq
More to come. Enjoy!
FAQs
Simple predicate logic chaining
The npm package premise receives a total of 1 weekly downloads. As such, premise popularity was classified as not popular.
We found that premise demonstrated a not healthy version release cadence and project activity because the last version was released 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
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.