Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Adds a few utilities based on the delicious Ramda library.
npm i ramdasauce --save
ramda 0.24.+
.Here's the quick list of functions and a simple example.
import RS from 'ramdasauce'
// --- Conversions ---
RS.toDate(1e12) // a Number to a date Object
RS.toNumber('5') // a String to a Number
// --- Object Shenanigans ---
const x = {a: 1, b: 2, c: {x: [5, 6]}}
RS.mapKeys(R.toUpper, x) // transforms the keys of an object by the function
RS.dotPath('c.x.0', x) // fetches a value from a nested object by a string path
// --- Generating Things ---
RS.rangeStep(2, 2, 10) // generates a range of numbers with a step
// --- Finding Things ---
RS.findByProp('id', 'a', [{id: 'a', id: 'b'}]) // finds an object by propEq
RS.findIndexByProp('id', 'a', [{id: 'a', id: 'b'}]) // finds the index of an object by propEq
// --- Predicates ---
RS.isUndefined(qwerty) // check if something is undefined
RS.isNotNil(null) // check if something is not null or undefined
RS.isNilOrEmpty(null) // checks if something is null, undefined or R.isEmpty
RS.isWithin(1, 2, 2) // is the 3rd parameter within the range of 1st through 2nd?
RS.isNotWithin(1, 2, 100) // is the 3rd parameter not within the range of 1st through 2nd?
RS.eqLength([1,2,3], 'abc') // tests 2 things to see if their length properties are the same
Most of these functions were lifted from stuff I wrote in real projects.
(leans in and whispers)
I did look at these tho:
These helper functions target that sweet spot between:
Not right for
ramda
core.
and
Would never be used outside your app.
Functions being added here must be used in an app. Preferable more than once.
I hope this library won't turn into something like this:
RS.portmanteau('functor', 'wrecked')
RS.yearsForAnimalInAsianCalendars('monkey')
Do you have any common ramda
patterns you use frequently? Drop some issues or PRs in!
startsWith
and endsWith
are flagged for removal in 3.0.0 (ramda has these now)random
and sample
are flagged for removal in 3.0.0 (impure functions)log
and trace
are flagged for removal in 3.0.0 (impure debug functions)isWithin
to play nice with Webpack - @hubciorz (#7)FAQs
Utilities for Ramda.
The npm package ramdasauce receives a total of 13,715 weekly downloads. As such, ramdasauce popularity was classified as popular.
We found that ramdasauce 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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.