mathisbullinger / froebel Goto Github PK
View Code? Open in Web Editor NEWA strictly typed utility library.
Home Page: https://www.npmjs.com/package/froebel
License: ISC License
A strictly typed utility library.
Home Page: https://www.npmjs.com/package/froebel
License: ISC License
Could not find a declaration file for module 'froebel/forward'. '/Users/daniel/testproject/node_modules/froebel/forward.mjs' implicitly has an 'any' type.
There are types at '/Users/daniel/testproject/node_modules/froebel/forward.d.ts', but this result could not be resolved when respecting package.json "exports". The 'froebel' library may need to update its package.json or typings.
Adding a types
property to every export in package.json solves it:
{
"name": "froebel",
"version": "0.23.2",
"description": "TypeScript utility library",
"main": "index.js",
"types": "index.d.ts",
"exports": {
".": {
"require": "./index.js",
"import": "./index.mjs",
"types": "./index.d.ts"
},
"./atWrap": {
"require": "./atWrap.js",
"import": "./atWrap.mjs",
"types": "./atWrap.d.ts"
},
"./batch": {
"require": "./batch.js",
"import": "./batch.mjs",
"types": "./batch.d.ts"
},
"./bimap": {
"require": "./bimap.js",
"import": "./bimap.mjs",
"types": "./bimap.d.ts"
},
"./bundle": {
"require": "./bundle.js",
"import": "./bundle.mjs",
"types": "./bundle.d.ts"
},
"./callAll": {
"require": "./callAll.js",
"import": "./callAll.mjs",
"types": "./callAll.d.ts"
},
"./case": {
"require": "./case.js",
"import": "./case.mjs",
"types": "./case.d.ts"
},
"./clamp": {
"require": "./clamp.js",
"import": "./clamp.mjs",
"types": "./clamp.d.ts"
},
"./clone": {
"require": "./clone.js",
"import": "./clone.mjs",
"types": "./clone.d.ts"
},
"./debounce": {
"require": "./debounce.js",
"import": "./debounce.mjs",
"types": "./debounce.d.ts"
},
"./ds": {
"require": "./ds.js",
"import": "./ds.mjs",
"types": "./ds.d.ts"
},
"./equal": {
"require": "./equal.js",
"import": "./equal.mjs",
"types": "./equal.d.ts"
},
"./equality": {
"require": "./equality.js",
"import": "./equality.mjs",
"types": "./equality.d.ts"
},
"./error": {
"require": "./error.js",
"import": "./error.mjs",
"types": "./error.d.ts"
},
"./except": {
"require": "./except.js",
"import": "./except.mjs",
"types": "./except.d.ts"
},
"./forward": {
"require": "./forward.js",
"import": "./forward.mjs",
"types": "./forward.d.ts"
},
"./function": {
"require": "./function.js",
"import": "./function.mjs",
"types": "./function.d.ts"
},
"./ident": {
"require": "./ident.js",
"import": "./ident.mjs",
"types": "./ident.d.ts"
},
"./index": {
"require": "./index.js",
"import": "./index.mjs",
"types": "./index.d.ts"
},
"./invoke": {
"require": "./invoke.js",
"import": "./invoke.mjs",
"types": "./invoke.d.ts"
},
"./isPromise": {
"require": "./isPromise.js",
"import": "./isPromise.mjs",
"types": "./isPromise.d.ts"
},
"./iterable": {
"require": "./iterable.js",
"import": "./iterable.mjs",
"types": "./iterable.d.ts"
},
"./list": {
"require": "./list.js",
"import": "./list.mjs",
"types": "./list.d.ts"
},
"./map": {
"require": "./map.js",
"import": "./map.mjs",
"types": "./map.d.ts"
},
"./math": {
"require": "./math.js",
"import": "./math.mjs",
"types": "./math.d.ts"
},
"./memoize": {
"require": "./memoize.js",
"import": "./memoize.mjs",
"types": "./memoize.d.ts"
},
"./merge": {
"require": "./merge.js",
"import": "./merge.mjs",
"types": "./merge.d.ts"
},
"./noop": {
"require": "./noop.js",
"import": "./noop.mjs",
"types": "./noop.d.ts"
},
"./nullish": {
"require": "./nullish.js",
"import": "./nullish.mjs",
"types": "./nullish.d.ts"
},
"./nullishChain": {
"require": "./nullishChain.js",
"import": "./nullishChain.mjs",
"types": "./nullishChain.d.ts"
},
"./object": {
"require": "./object.js",
"import": "./object.mjs",
"types": "./object.d.ts"
},
"./omit": {
"require": "./omit.js",
"import": "./omit.mjs",
"types": "./omit.d.ts"
},
"./oneOf": {
"require": "./oneOf.js",
"import": "./oneOf.mjs",
"types": "./oneOf.d.ts"
},
"./partial": {
"require": "./partial.js",
"import": "./partial.mjs",
"types": "./partial.d.ts"
},
"./partition": {
"require": "./partition.js",
"import": "./partition.mjs",
"types": "./partition.d.ts"
},
"./path": {
"require": "./path.js",
"import": "./path.mjs",
"types": "./path.d.ts"
},
"./pick": {
"require": "./pick.js",
"import": "./pick.mjs",
"types": "./pick.d.ts"
},
"./pipe": {
"require": "./pipe.js",
"import": "./pipe.mjs",
"types": "./pipe.d.ts"
},
"./predicate": {
"require": "./predicate.js",
"import": "./predicate.mjs",
"types": "./predicate.d.ts"
},
"./prefix": {
"require": "./prefix.js",
"import": "./prefix.mjs",
"types": "./prefix.d.ts"
},
"./promise": {
"require": "./promise.js",
"import": "./promise.mjs",
"types": "./promise.d.ts"
},
"./promisify": {
"require": "./promisify.js",
"import": "./promisify.mjs",
"types": "./promisify.d.ts"
},
"./queue": {
"require": "./queue.js",
"import": "./queue.mjs",
"types": "./queue.d.ts"
},
"./range": {
"require": "./range.js",
"import": "./range.mjs",
"types": "./range.d.ts"
},
"./repeat": {
"require": "./repeat.js",
"import": "./repeat.mjs",
"types": "./repeat.d.ts"
},
"./select": {
"require": "./select.js",
"import": "./select.mjs",
"types": "./select.d.ts"
},
"./settled": {
"require": "./settled.js",
"import": "./settled.mjs",
"types": "./settled.d.ts"
},
"./shuffle": {
"require": "./shuffle.js",
"import": "./shuffle.mjs",
"types": "./shuffle.d.ts"
},
"./sortedArray": {
"require": "./sortedArray.js",
"import": "./sortedArray.mjs",
"types": "./sortedArray.d.ts"
},
"./sortedMap": {
"require": "./sortedMap.js",
"import": "./sortedMap.mjs",
"types": "./sortedMap.d.ts"
},
"./string": {
"require": "./string.js",
"import": "./string.mjs",
"types": "./string.d.ts"
},
"./suffix": {
"require": "./suffix.js",
"import": "./suffix.mjs",
"types": "./suffix.d.ts"
},
"./surround": {
"require": "./surround.js",
"import": "./surround.mjs",
"types": "./surround.d.ts"
},
"./take": {
"require": "./take.js",
"import": "./take.mjs",
"types": "./take.d.ts"
},
"./throttle": {
"require": "./throttle.js",
"import": "./throttle.mjs",
"types": "./throttle.d.ts"
},
"./truthy": {
"require": "./truthy.js",
"import": "./truthy.mjs",
"types": "./truthy.d.ts"
},
"./types": {
"require": "./types.js",
"import": "./types.mjs",
"types": "./types.d.ts"
},
"./unary": {
"require": "./unary.js",
"import": "./unary.mjs",
"types": "./unary.d.ts"
},
"./unzip": {
"require": "./unzip.js",
"import": "./unzip.mjs",
"types": "./unzip.d.ts"
},
"./zip": {
"require": "./zip.js",
"import": "./zip.mjs",
"types": "./zip.d.ts"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/MathisBullinger/froebel.git"
},
"author": "Mathis Bullinger",
"license": "ISC",
"bugs": {
"url": "https://github.com/MathisBullinger/froebel/issues"
},
"homepage": "https://github.com/MathisBullinger/froebel#readme",
"devDependencies": {
"@babel/cli": "^7.18.10",
"@babel/core": "^7.18.10",
"@babel/plugin-transform-typescript": "^7.18.12",
"@babel/preset-env": "^7.18.10",
"@types/node": "^17.0.35",
"typedoc": "^0.22.17",
"typescript": "^4.7.3"
}
}
When commiting changes to the code all typescript files are checked to be in the right format. I think its enogh to check only files beloning to the current change. What do you think @MathisBullinger ?
throttle breaks the default React Native build (0.70.2).
performance
isn't available in React Native, and neither is perf_hooks
.
I have not yet investigated the conventional alternative.
Basically I'm not sure about lodash's _.merge
.
The docs are extremely "wordy" around enumerable properties, giving me pause about the implementation, and the type defs Iโve seen in lodash (so far) seem overly complicated.
Related: sindresorhus/ts-extras#55
I saw your post about type-checking a pipe
function here and posted a reply:
Does it need to be recursive?
Here's the approach I came up with, before giving up:
My approach was to just take one item off the start of the list, and one item off the end of the list - derive the input arguments and output return types from the two lists, and then see if they're the same.
If we can compute a set of InputTypes
and OutputTypes
and just check if those match, why do we need the whole recursive thing?
For better error reporting maybe? I guess with my approach, the entire array will be faulted - whereas with your approach, the error will point to the individual argument at fault?
It would be great to have a unary
utility. Like this in plain JS but not sure how to implement it in TS:
const unary = (f) => {
return f.length === 1 ? f : (args) => f(args)
}
That way we could do things like:
['1', '2', '3'].map(unary(parseInt))
Example this discussion/explanation about why the unary utility is useful.
My apologies if this already exists in here under a different name. This is a fantastic library! ๐
It would be nice to have a castArray utility.
something like this
function castArray<T>(x: T | T[]): T[] {
return x === undefined ? [] : Array.isArray(x) ? x : [x];
}
A lot of frameworks use Proxies for their reactivity, Vue included, but that makes it impossible to use structuredClone.
Vue team explicitely suggests to use clone functions, but this library clone function uses structured clone if available, which breaks thing when proxies are involved, unless of course you use browser which doesn't support structuredClone, then things work correctly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.