![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
sym-diff-by-props
Advanced tools
Find the symmetric difference of two arrays of objects by comparing a a set of shared properties
Find the symmetric difference of two arrays of objects by comparing a a set of shared properties
Because before I was using ramda like so to calculate a symmetric difference: symmetricDifferenceWith(eqBy(props['a', b']))
. Turns out that when either one of the input lists has more then ~ 100 elements, ramda starts to get really slow when calculating the symmetric difference. I love ramda but the performance of this usage of ramda became a pain point for me recently and so I decided to roll my own with a specific focus on solving the symmetric difference between two arrays of objects by analysing a list of shared properties.
I have included some basic tests if you want to see for yourself just how much slower ramda takes for this with marignally larger arrays: Clone the repo, run yarn
or npm i
, then yarn test
or npm t
.
As a nice side benefit, this package is dependency-free. No getting tons of extra packages shoehorned in to your project just because you want to use this one.
npm i sym-diff-by-props
or yarn add sym-diff-by-props
then:
const symDiffByProps = require('sym-diff-by-props');
const list1 = [{ a: 6, b: 'foo' }, { a: 3, b: 'adderall' }, { a: 5, b: 'chocolate' }];
const list2 = [{ a: 3, b: 'adx' }, { a: 6, b: 'foo' }, { a: 5, b: 'chocolate' }, { a: 3, b: 'adderall' }, { a: 6, b: 'foo' }, { a: 50, b: 'crazy' }];
const symDiff = symDiffByProps(['a', 'b'], list1, list2);
console.log(symDiff); // [{a: 3, b: 'adx'}, {a: 50, b: 'crazy'}]
FAQs
Find the symmetric difference of two arrays of objects by comparing a a set of shared properties
The npm package sym-diff-by-props receives a total of 1 weekly downloads. As such, sym-diff-by-props popularity was classified as not popular.
We found that sym-diff-by-props 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.