A utility belt that normalizes and wraps `Ramda` and `Lodash/FP`.
npm install omnibelt!Build Status 
A utility belt that normalizes and wraps Ramda and Lodash/FP. In addition, some other "adjunct" methods are included that solve common patterns. The order of precedence is: Does it exist in Ramda? Does it exist in Lodash/FP? Then it must be custom (in src/omnibelt). That means that you can deconstruct methods from any of those three from the omnibelt exported object.
``js`
const {
merge, converge, toString, // Ramda
isNull, throttle, camelCase, // Lodash
isPopulatedString, // Omnibelt
} = require('omnibelt');
... I've only grouped them for demonstration purposes, please don't do that in your code.
`bash`
yarn run test
Deconstruction
`js
const { isPopulatedString, toLower } = require('omnibelt');
const foo = 'foo';
if (!isPopulatedString(foo)) {
throw new Error('DANGER');
} else {
return toLower(foo);
}
`
Namespaced - Use O by convention
`js
const O = require('omnibelt');
const foo = 'foo';
if (!O.isPopulatedString(foo)) {
throw new Error('DANGER');
} else {
return O.toLower(foo);
}
`
- What is this method :: Type -> Type stuff? It's Hindley-Milner Notation.omnibelt
- Since most methods are straight from the source, refer to the Ramda and Lodash/FP on their respective sites.
- Docs and examples for the methods are collocated with the method's definition. When contributing a new function, please provide docs (and tests).
JSDoc definitions at the top of each of the omnibelt module functions should be kept up to date and are meant to describe the usage of each function in detail. From these doc comments, a documentation site is generated using the Docdash template.
You can open the docs locally by running the following npm script on a mac. In general (and for non-mac machines), you can simply opening docs/index.html in a browser.
`bash`
yarn run docs
You can also see documentation for the latest tag on the GitHub pages for this project.
https://losant.github.io/omnibelt/
#### Building
Docs should be generated when a new version is tagged and pushed. Ramda and Lodash docs are autogenerated as part of a pre build step and you shouldn't have to interface with manually updating which methods are being pulled in. Docs are committed to docs and are served as a GitHub page whenever master is updated.
`bash`
yarn run docs:build
git add -A
git commit -m "Regenerated docs"
`bashpackage.json
git co develop
git fetch
git pullUpdate
versionREADMEUpdate
changelog, naming the latest version`
yarn run docs:build
git add -A
git commit -m "version bump and doc regeneration"
git push
git checkout master
git merge develop
git release vX.X.X
Below should serve as an "upgrade guide" jumping off point as you are migrating projects to newer versions of this package. Ideally, interface changes will be called out specifically and one should not have to go sifting through git diffs to discern what changed.
-4.0.00.30.1
- moved from travis to github actions
- bumped ramda to 3.1.2
- bumped various dev dependencies
- drop support for node.js version 14 and 16.
- debounceLeading
- Added methods:
- debounceTrailing
- 3.1.1
- size
- Added methods:
- (Lodash)@rjhilgefort/export-dir
- removed .import { size } from 'omnibelt'
- updated index.js files to be destructured on import such as .3.1.0
- 18.16.0
- bumped .node-version to 0.29.0
- bumped ramda to (note in this version of ramda they release a function called isNotNil, omnibelt has a isNotNil function already so that ramda function is not included in this library)3.0.0
- bumped various dev dependencies
- 16.17.1
- bumped .node-version to 0.28.0
- drop support for node versions, 10, 12, 13, and 15
- bumped ramda version (note in this version of ramda they release a function called count, omnibelt has a count function already so that ramda function is not included in this library)1.5.0
- bumped @losant/eslint-config-losant to 29.3.1
- bumped expect to 10.1.0
- bumped fs-extra 8.0.2
- bumped husky 29.3.1
- bumped jest 4.0.0
- bumped jsdoc 13.0.3
- bumped lint-staged 2.1.0
- added taffdb as a dev dependency for building the documentation
- mapP
- waits for all promises to complete and then throw the first error if foundmapParallelLimitP
- does not continue to run promises once a promise has erroredresolveProps
- waits for all promises to complete and then throws the first error if found2.0.2
- 14.16.1
- bumped .node-version to 4.17.21
- bumped lodash to 1.4.3
- bumped @losant/eslint-config-losant to 4.7.7
- bumped handlebars to 6.0.0
- bumped husky 26.6.3
- bumped jest 11.0.0
- bumped lint-staged 2.0.1
- mapSerialP
- Added 14.15.0
- bumped .node-version to 26.6.2
- bumped expect to 26.6.2
- bumped jest to 10.5.1
- bumped lint-staged to 2.0.0
- ramda
- bumped to 0.27.1lodash
- bumped to 4.17.20@rjhilgefort/export-dir
- bumped to 2.0.01.3.3
- dropped support for Node.js 8 and 9
- various development dependencies updated
- added Node.js 13, 14, and 15 to travis
- ramda
- bumped to 0.27.0@rjhilgefort/export-dir
- bumped to 1.1.31.3.2
- lodash
- bumped to 4.17.15string-format
- bumped to 2.0.0timeoutP
- various development dependencies updated
- stack trace improvement for 1.3.1
- isPlainObject
- Added methods:
- 1.3.0
- lodash
- Updating linting, fix various spelling and linting errors
- bumped to 4.17.11evolveArray
- Ramda upgraded from 0.25.0 to 0.26.1
- Removed internal implementation of thunkify, now comes from Ramda
- Removed , Ramda evolve now supports arrays with evolvestringify-object
- bumped to 3.3.0allSettledP
- Added methods:
- forEachSerialP
- mapParallelLimitP
- evolveArray
- Removed methods:
- evolve
- 0.26.0 Ramda now supports arrays1.2.0
- git remote set-url origin git@github.com:Losant/omnibelt.git
- Repo renamed and open sourced!
- lodash
- bumped to 4.17.10string-format
- bumped to 1.0.0mapIndexed
- Added methods:
- 1.1.9
- mapP
- Added methods:
- timeout
- Method name change:
- -> timeoutP1.1.8
- 1.1.7
- Ability to generate a static documentation site that's hosted on GitHub pages.
- ensureEndsWith
- Added methods:
- 1.1.6
- testHarness
- External changes:
- and the like, no longer assume that expect is available in your environment through jest. Instead, you must pass expect in as a dependency. See this issue for more info.1.3.2
- Internal changes:
- linter update to equalsAny
- tests for containsAll
- tests for 1.1.5
- testHarness
- Added methods:
- testCases
- evolveArray
- Internal changes:
- Linter bumped and ran on project.
- Tests for .1.1.4
- 0.25.0
- ⬆️ Ramda upgrade to . Upgrade guide here.tap
- has been omitted from Ramda and implemented in this project to work around new version.toInteger
- Added methods:
- (Lodash)testHarness
- Remove methods:
- : Now is not exported as part of this library and is only used internallytest*
- Internal changes:
- methods have been moved to test/ and are only for internal use.testHarness
- has been updated with a new interface. testHarnessUnary is still around for backwards compatibility.testCases
- now exists to eliminate a common pattern when using testHarness.1.1.3
- ramda
- All internal Losant utilities now only require the specific function(s) they need from /lodash.forEach
- The following methods are now pulled from Lodash instead of Ramda:
- : Note that forEachObjIndexed still comes from ramda (behaves as expected)indexBy
- Removed methods:
- from Ramda has been omitted in favor of keyByparseInt
- from Lodash has been omitted because it conflicts poorly with nativedotPath
- Added methods:
- dotPathOr
- eqDotPaths
- eqDotPathsShallow
- equalsShallow
- toPlainObject
- (Lodash)toNumber
- (Lodash)mapFilter
- filterMap
- mapRejectNil
- rejectNilMap
- defer
- noopAsync
- resolveProps
- timeout
- 1.1.2
- keyByWith
- Added methods:
- 1.1.1
- sleep
- Added methods:
- round
- within
- 1.1.0
- clampPositive
- All docs now collocated with implementations.
- Added methods:
- count
- intersectAny
- upperCamelCase
- flattenShallow
- Removed methods:
- R.unnest
- This is just (though flattenShallow is a bit more semantic).1.0.12
- ramda
- back down to 0.24.1.1.0.11
- git remote set-url origin git@github.com:Losant/omnibelt.git
- Moved git repo from Bitbucket to GitHub, update your remotes!
- nonePass
- Added methods:
- eqPaths
- ensureStartsWith
- throttleLeading
- throttleTrailing
- flip
- Moved methods:
- now comes from lodash/fpthrottle
- is now "custom" and accepts 3 arguments (still curried)debounce
- is now "custom" and accepts 3 arguments (still curried)1.0.10
- containsAny
- Node and Yarn version less restrictive, allows anything newer.
- Added methods:
- isNotNil
- toString
- The following methods are now pulled from Lodash instead of Ramda:
- toLower
- toUpper
- trim
- split
- 1.0.9
- jsonParseSafe
- Added methods:
- thunkify
- tryCatchSafe
- 1.0.8
- fpThrow
- now accepts an Error object and will rethrow when passed.1.0.7
- allEqual
- Converted to flat structure that exports all of the Lodash, Ramda, and custom methods that we're using.
- New documentation standard introduced, but not fully converted to.
- Dependency updates.
- Added methods:
- argsToObj
- containsAll
- defaultToStrict
- ensureArray
- equalsAny
- evolveArray
- flattenShallow
- fpThrow
- isNilOrEmpty
- isNotEmpty
- isNot
- list
- mergeSpec
- propOrStrict
- stringify
- updateKeys
- updateKeysWith
- updateKeyPaths
- 1.0.6
- format
- Added methods:
- isPopulatedString
- mergeWithArrays
- replaceAll
- stringToBoolean
- trace
- README.md` documentation can be found at the rood of the repo.
-