js-drivecommons v2.1.0
JS-DRIVE Commons
Motivation
Reuse javascript utils and middlewares along Zara Drive applications
Install
npm i js-drivecommons
Use
Utils
Exported data utils can be found in UTILS
Controllers
Exported controllers can be found in CONTROLLERS
Routers
Exported routers can be found in ROUTERS
Services
Exported services can be found in SERVICES
Middlewares
Exported middlewares can be found in MIDDLEWARES
Tips: On Date Join Middlewares
We publish multiple middlewares to allow a local_date
join process. All this middlewares receives 4 arguments as input from ctx.state
:
current
: Array with data grouped by datecomp
: Array with comparable data grouped by datefilters.comparableDate.data
: Array with local_date and comparable date associations, like: { local_date: '2019-11-12', comparable_commercial: '2018-11-13', comparable_calendar: '2018-11-12' }compType
: String with comprable type commercial | calendar | custom
There are two types of middlewares, comparableJoin
and comparableA2Join
, and each of them have 3 subtypes of middlewars:
- comparableJoin | comparableA2Join: Joins in dates from
filters.comparableDate.data
the data fromcurrent
andcomp
. So return data will have all possible dates. - comparableLeftJoin | comparableA2LeftJoin: This middleware uses left join strategy, so as the left part of the join is
current
data, return will have all dates from left side, joined with mathes fromcomp
(right side) usingfilter.comparableDate.data
associations. - comaprableRightJoin | comparableA2RightJoin: This middleware uses right join strategy, so return will have all
comp
data joined withcurrent
data matches usingfilter.comparableDate.data
associations.
More info
More info in DOCS.
Development
npm install
To build for production, run:
npm run build
To run the unit tests for the components, run:
npm test
You'll find the compiled module under /dist
dir.
Deployment
Every release is built and deployed to npm via Github Actions.
Maintainers
- Adrián Insua Yañez @AdrianInsua
- Diego Jesús González González @diego-j-gonzalez
Contributing
See Contributing
Changelog
See Changelog
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago