Comments (22)
https://github.com/smartprocure/futil-js#compactobject
https://github.com/smartprocure/futil-js#unflattenobject
https://github.com/smartprocure/futil-js#commonkeys
from rambda.
wrong export
Revert export
field changes in package.json
due to ramda/ramda#3236
from rambda.
Data first Rambda
Rameda alike
As it is hard to create so many files, just exporting _
which will contain one file, much like the initial version of Rambda
from rambda.
Dictionary - type vs interface
from rambda.
isValid with functions
only arrow function works
ok(repos)(fn)
// ok(repos)(x => {
// console.log({x})
// })
also not possible is array of function schema
ok(repos)([x => {
console.log({x})
}])
from rambda.
Methods to add:
- whereAny
- uniqBy
- propSatisfies
- pickBy
- pathSatisfies
- gte
- mapObjIndexed(types from @types/ramda | added but types are not from there)
https://github.com/smartprocure/futil-js#differentlast
https://github.com/smartprocure/futil-js#whentruthy
findApply
compactMap
compactJoin
flattenObject
simpleDiff
highlight
on
off
includeLens?
from rambda.
Maybe https://github.com/13d-io/maybe-just-maybe
from rambda.
Faster isObject?
https://github.com/neotan/simda/blob/master/src/internal/_isObject.js
from rambda.
https://github.com/MartinPavlik/ramda-async/blob/master/index.ts
from rambda.
- R.mapKeys (name inspiration from https://github.com/AlexGalays/spacelift#objectmapvalues)
from rambda.
Add R.mapToList which takes object and returns a list
from rambda.
include eslint-plugin-mocha
as notable users
from rambda.
SKIPPED
Duplication of test, readme example and typings test. As it depends on REPL, documentation site needs to be build first.
The idea is to move build information from files/index.d.ts
to the source
files. Maybe run Jest test in browser instead of having REPL app.
from rambda.
use proper naming such as functor https://github.com/hemanth/functional-programming-jargon?utm_source=hackernewsletter&utm_medium=email&utm_term=code#functor
from rambda.
apply for inclusion in https://github.com/hemanth/functional-programming-jargon once more FP functions are added
from rambda.
try transducers from Ramda to be included
from rambda.
Rambdax has issues with _consumetypings tests
from rambda.
- Add
R.mapAllSettled
Explanation: It asynchronously iterates over a list using Promise.allSettled
.
import { delay } from './delay.js'
import { join } from './join.js'
import { map } from './map.js'
import { mapAllSettled } from './mapAllSettled.js'
import { pipeAsync } from './pipeAsync.js'
const fn = async (x, i) => {
await delay(100)
if (i % 2) throw new Error(foo-${ i }
)
return x + 1
}
test('happy', async () => {
await expect(mapAllSettled(fn, [ 1, 2, 3, 4 ])).resolves
.toMatchInlineSnapshot([ { "status": "fulfilled", "value": 2, }, { "reason": [Error: foo-1], "status": "rejected", }, { "status": "fulfilled", "value": 4, }, { "reason": [Error: foo-3], "status": "rejected", }, ]
)
})
test('inside pipe', async () => {
const result = await pipeAsync(
mapAllSettled(fn),
map(({ status }) => status),
join('-')
)([ 1, 2, 3 ])
expect(result).toBe('fulfilled-rejected-fulfilled')
})
===
export async function mapAllSettledFn(fn, arr){
const promised = arr.map((a, i) => fn(a, i))
return Promise.allSettled(promised)
}
export function mapAllSettled(fn, arr){
if (arguments.length === 1){
return async holder => mapAllSettledFn(fn, holder)
}
return new Promise((resolve, reject) => {
mapAllSettledFn(fn, arr).then(resolve)
.catch(reject)
})
}
from rambda.
restore
import isCI from 'is-ci'
import { resolve } from 'path'
import { execCommand } from '../files/execCommand.js'
jest.setTimeout(3 * 60 * 1000)
/**
* "consume-typings:clone": "cd .. && git clone --depth 1 https://github.com/selfrefactor/rambda-scripts.git rambda-scripts-clone",
"consume-typings:execute": "cd ../rambda-scripts-clone/scripts/consume-typings && yarn start",
"consume-typings": "yarn consume-typings:clone && yarn consume-typings:execute",
*/
const DIR = resolve(__dirname, '../../')
test('typings can be imported', async () => {
if (!isCI) return
await execCommand('rm -rf rambda-scripts-clone', DIR)
await execCommand('yarn build:main')
expect(await execCommand('yarn consume-typings')).toBeTrue()
})
from rambda.
import { pathFn } from './path.js'
export const removePath = (object, path) => {
const pathResult = pathFn(path, object)
if (pathResult === undefined) return object
if (!path.length) return object
const [ head, ...tail ] = path
if (tail.length === 0){
const { [ head ]: _, ...rest } = object
return rest
}
if (!object[ head ]) return object
return {
...object,
[ head ] : removePath(object[ head ], tail),
}
}
export function omitPaths(paths, obj){
if (arguments.length === 1){
return _obj => omitPaths(paths, _obj)
}
return paths.reduce((result, path) => {
const pathParts = path.split('.')
return removePath(result, pathParts)
}, obj)
}
---
import { omitPaths } from './omitPaths.js'
const object = {
a : {
b : {
c : 1,
d : 2,
},
},
foo : {
bar : 3,
baz : 4,
},
}
test('happy', () => {
const result = omitPaths([ 'a.b.c', 'foo.bar' ], object)
const curried = omitPaths([ 'a.b.c', 'foo.bar' ])
const expected = {
a : { b : { d : 2 } },
foo : { baz : 4 },
}
expect(result).toEqual(expected)
expect(curried(object)).toEqual(expected)
})
test('with no matching path', () => {
expect(omitPaths([ 'a.b.c.d.e.f', 'foo.bar.123' ], object)).toEqual(object)
})
from rambda.
from rambda.
https://github.com/Maggi64/moderndash/blob/main/package/src/object/flatKeys.ts
from rambda.
Related Issues (20)
- Fix Typescript typos to TypeScript HOT 2
- Wrong type definition for propEq HOT 2
- equals crashing on parseError HOT 3
- Rambda 8.4.0 - Type 'K' cannot be used to index type 'Args' HOT 7
- Add sortWith HOT 4
- Type error for dissocPath - error TS2554: Expected 1 arguments, but got 2 HOT 3
- sortWith is missing in 8.6.0 HOT 2
- Missing release tag v8.6.0 HOT 1
- Add `reduceBy` HOT 2
- Looking for more core contributers/owners for this project HOT 5
- Composition of Lenses do not type properly HOT 8
- [BUG] - Upgrade to rambda 9 HOT 1
- Hijack Question for code-complexity: Add cognitive complexity as well HOT 1
- Rambda 9 release? HOT 3
- [BUG] R.cond transform is unary HOT 1
- [BUG] Behavior of rambda isEmpty() deviates from ramda's isEmpty() function HOT 2
- [BUG] Remove the SRC and Readme from dist folder HOT 2
- R.once TS type definition miss to context argument and its type HOT 4
- [BUG] Node cannot resolve `rambda/immutable` import path in js file bundled by rollup+typescript HOT 5
- [BUG] the deno instructions don't work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rambda.