smartprocure / futil-js Goto Github PK
View Code? Open in Web Editor NEWF(unctional) util(ities). Resistance is futile.
Home Page: https://smartprocure.github.io/futil-js/
License: MIT License
F(unctional) util(ities). Resistance is futile.
Home Page: https://smartprocure.github.io/futil-js/
License: MIT License
Since we're in favor of codeclimate, to see it's full potential and to increase sanity and simplicity for our current and future projects, we should pick a JavaScript style. CodeClimate offers a list of eslint plugins that are supported, and the ones that seem to be relevant for this purpose are:
There are also many other benefits of using standard stuff (pardon my laziness π).
I can't fix it since it's asking for an admin to do it πΆ
Every real library has a fancy logo. We clearly need one.
Maybe something looks like a borg cube?
Hi! Just as a reminder :) I don't want to forget that.
For the repeated array thing
Branch | Build failing π¨ |
---|---|
Dependency | eslint-plugin-import |
Current Version | 2.3.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-import is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 10 commits.
44ca158
update utils changelog
a3728d7
bump eslint-module-utils to v2.1.0
3e29169
bump v2.4.0
ea9c92c
Merge pull request #737 from kevin940726/master
8f9b403
fix typos, enforce type of array of strings in allow option
95315e0
update CHANGELOG.md
28e1623
eslint-module-utils: filePath in parserOptions (#840)
2f690b4
update CI to build on Node 6+7 (#846)
7d41745
write doc, add two more tests
dedfb11
add allow glob for rule no-unassigned-import, fix #671
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
The goal is to capture this use case for radio buttons and mutex checkboxes:
{...{
onChange: e => { field.value = e.target.value },
value: option,
checked: field.value == option,
}}
Given that we have checkboxValues
, we probably shouldn't call it checkboxValue
as that'd be too close. Likely name would be radioValue
which is probably more intuitive than mutexValue
I think it can be like this:
export let asyncFlow = (head, ...tail) => async (...params) => asyncFlow(...tail)(await head(...params))
The should support .onError and before (concurrency, errors, and status aspects)
and should support single error
unit tests are failing.
They are the same :)
processQuotes
may not be needed, consider removal
Add an uncurry fn
Example
(n, f) => _.curry(R.uncurryN(n, f))
I am trying to use this library in a Typescript project (expecially the function helpers are great in my case). However, the project itself includes no .d.ts file and there is also none via npm install @types/futil-js.
Would it be possible for the author to create/add a typescript definitions file?
https://smartprocure.github.io/futil-js/#api-lang-append
Given the order of concatenation is reversed from the order of the arguments, this would be better described as prepend instead of append.
F.postings(/a/g, 'vuhfaof')
returns [ [ 4, 5 ] ]
F.postings(/a/, 'vuhfaof')
never returns at all -- you're stuck in the while loop at https://github.com/smartprocure/futil-js/blob/master/src/regex.js#L42-L45 because without the g
flag regex.exec() doesn't consume the initial match and so just finds it again forever.
Two possible fixes:
regex = new RegExp(regex.source, regex.flags + 'g')
g
flag. They're expecting the first match..exec
-ing, else do the while loop
Either fix is simple but I'll wait on feedback as to the preferred behavior.
Browser tests are still failing. See: https://circleci.com/gh/smartprocure/futil-js/968?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
Here's a plain text copy of the issue:
Chrome 26.0.1410 (Windows 7 0.0.0) ERROR
{
"message": "Uncaught ReferenceError: __VERSION__ is not defined\nat webpack:///node_modules/lodash/lodash.min.js:5:1 <- src/index.js:5",
"str": "Uncaught ReferenceError: __VERSION__ is not defined\nat webpack:///node_modules/lodash/lodash.min.js:5:1 <- src/index.js:5"
}
Chrome 26.0.1410 (Windows 7 0.0.0) ERROR
{
"message": "Uncaught ReferenceError: __VERSION__ is not defined\nat webpack:///node_modules/lodash/lodash.min.js:5:1 <- src/index.js:5",
"str": "Uncaught ReferenceError: __VERSION__ is not defined\nat webpack:///node_modules/lodash/lodash.min.js:5:1 <- src/index.js:5"
}
Chrome 26.0.1410 (Windows 7 0.0.0): Executed 0 of 0 ERROR (1.06 secs / 0 secs)
We should have a real docs site like lodash, ramda, etc.
Currently, we're waiting on lodash 5 progress since we'd like to do the same thing as lodash, but their doc generation is currently unclear while they're working on v5.
Mobile Safari 11.0.0 (iOS 11.0.0) WARN: '%cUnhandled rejection Error: error
_callee7$@http://localhost:9876/base/test/aspect.spec.js?44eec46c90e131c2bf886429dff1430f699d0a43:14463:34
tryCatch@http://localhost:9876/base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:6151:44
invoke@http://localhost:9876/base/node_modules/babel-polyfill/dist/polyfill.js?03b9323c0501aae92009b27cf63cea3f4754b408:6442:30
step@http://localhost:9876/base/test/aspect.spec.js?44eec46c90e131c2bf886429dff1430f699d0a43:14273:202
promiseReactionJob@[native code]', 'color: red'
This seems to be reproduced in many browsers:
Mobile Safari 8.0.0 (iOS 8.4.0) ERROR: 'Unhandled promise rejection', AssertionError{message: 'expected promise to be rejected with 'Error: hi from aspect' but it was rejected with 'Error: hi from aspect'', showDiff: true, actual: 'Error: hi from aspect', expected: 'Error: hi from aspect', stack: 'AssertionError@http://localhost:9876/base/test/aspect.spec.js?45512c279a5a25377ccf6505f37f502ef315c0bc:2681:22
There are underscore/lodash decorators that might come handy, such as:
The defaultValue for cascade
seems like a bit of a hack. Instead, there should probably be two versions, one without the default value named cascade
and one with the default value named cascadeOr
. The latter would follow the argument order of getOr
, that is, default value first.
arrow functions does not binding its own arguments,
need to change the signature of maybeCall(fn)
to maybeCall(fn, ...args)
in order to call fn(...args)
inside.
add test for passing arguments to fn()
call inside maybeCall
Using _
as a placeholder obviates the need for the In
method conversions, because they only save a single character at the cost of new things to learn:
F.someMethodIn(x)
vs
_.someMethod(_, x)
Additionally, sometimes our conversion methods would be useful together, e.g. an In
and an On
. A good example is unset
- you might want to unset both in and on an object, and defining compound conversion conventions seems messy (unsetIon
?).
In order to make this work, we either need to explicitly curry all our conversions, or wait for lodash/lodash#3440 to be fixed
This is a followup to #144 to make sure that kind of thing never happens again.
As part of CI, we should run all of our unit tests in every browser. Sauce Labs and Browserstack free for open source so there's very little friction for us to do this.
This a method to walk a tree with async visitor/iteratee methods
We can get them all here:
https://libraries.io/npm/futil-js/versions
It seems like our master build is failing CI. Locally, it seems like it's due to something with eslint-plugin-mocha from eslint-config-smartprocure π€
@sadasant any ideas?
Should we move lodash to peer dependencies for futil? I'm wondering if that's adding extra weight to our downloads.
I know that we've been running tests against the lib file to make sure that the build works, but since this is the responsibility of babel, we could focus the tests on our source code instead. Among the benefits, we could perceive: an overall simplification of the npm scripts, cleaner test coverage and faster tests.
We use this sort in several places, let's add it here:
let sortByKey = _.curry((key, tabs) => _.sortBy(obj => {
let ord = _.get(key, obj)
return ord >= 0 ? ord : ord < 0 ? (tabs.length * 2) + ord
: tabs.length
}, tabs)
Helps with determining what version is really running, which occasionally is a mismatch with package.json (e.g. if versions are not locked down)
If we want to use CircleCI, we need to start it from a github organization owner.
Thanks to the awesome @joaonuno, we now have the futil
package name!
This ticket is to track all the steps we need to take to make it happen
Branch | Build failing π¨ |
---|---|
Dependency | webpack |
Current Version | 3.4.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As webpack is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
stats.excludeAssets
to allow to filter assets in list (@ldrick)import(/* webpackMode: "weak" */ "module")
to try to load a module without network request (@faceyspacey)require.context
which is the context mode. Can be false
, "eager"
, "lazy-once"
, "weak"
and "async-weak"
. (@faceyspacey)require.resolveWeak
now support expressions (@faceyspacey)ModuleConcatenationPlugin
)ModuleConcatenationPlugin
ConcatenatedModule
--help
output is flushed before process exit (@esbenp)stats
options are now validated by schema (@esbenp)CommonsChunkPlugin
in async mode without name
argument--resolve-extensions
(@tomek-d)has no internal name
when using dependency variable in root of scope-hoisted modules (ModuleConcatenationPlugin
)The new version differs by 68 commits.
75a8ffe
3.5.0
afa28c0
Merge pull request #5453 from webpack/bugfix/import-order-scope-hoisting
a569764
Merge pull request #5457 from tomek-d/resolve-extensions-typo
0b8023a
fixes #5096
29d1336
Fixed bug in --resolve-extensions parameter documentation
39051df
update example
7619c43
generate more pretty names for nested concatenation
6607cfa
remove ordering in ModuleConcatenationPlugin
2bbbf50
Merge pull request #5437 from esbenp/fix-help-output-test-5345
9f5bffa
beautify
334c1c4
remove unused variable
8835751
fix conflict handling
7099fcc
update stats test case
b77a52b
add reserved words to avoid syntax errors
16a5831
use old new Buffer api for node 4
There are 68 commits in total.
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
A trampoline is a loop that iteratively invokes thunk-returning functions (continuation-passing style). A single trampoline is sufficient to express all control transfers of a program; a program so expressed is trampolined, or in trampolined style; converting a program to trampolined style is trampolining. Trampolined functions can be used to implement tail-recursive function calls in stack-oriented programming languages.βWikipedia
See this post: http://raganwald.com/2013/03/28/trampolines-in-javascript.html
My dear friend @stefanmaric wrote a trampoline in this Gist: https://gist.github.com/stefanmaric/1dfc01dd3985d5b423f22fcad7c58da2
const trampoline = (fn) => (...args) => {
let result = fn(...args)
while (result instanceof Function) result = result()
return result
}
The idea is to enable shorthand so a scenario like this:
F.findApply(x => x.b, [{ c: 1 }, { b: 3 }]) // 3
Could be shortened to this:
F.findApply('b', [{ c: 1 }, { b: 3 }]) // 3
Just requires wrapping f
in _.iteratee
in collection.js
It'd be useful for quickly browsing the documentation if:
Similar to #138, if we instead construct 1 regex, it will be much faster. The match any case is easy - just join words
with |
.
We should improve our runkit example to require futil as F
, and maybe add one or two small examples.
See:
https://runkit.com/daedalus28/basic-mongo-json-schema-validation
The checks
are domain-specific. The validateTree
function could be a good futil helper, although its API needs to be discussed. Do we return a flattened tree? Do we give the option to bail on first error? Etc...
And then importing from index so that we can do the dynamic reduce thing but still have them as top level exports
Not just useful for a docs site, exploreAPI (currently https://runkit.com/daedalus28/explore-api-futil-candidate) could be used as part of a danger check to see if newly added API method's test cases match existing methods and warn if they do.
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.