js-drivecommons v2.1.0
JS-DRIVE Commons
Motivation
Reuse javascript utils and middlewares along Zara Drive applications
Install
npm i js-drivecommonsUse
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.datathe data fromcurrentandcomp. 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
currentdata, return will have all dates from left side, joined with mathes fromcomp(right side) usingfilter.comparableDate.dataassociations. - comaprableRightJoin | comparableA2RightJoin: This middleware uses right join strategy, so return will have all
compdata joined withcurrentdata matches usingfilter.comparableDate.dataassociations.
More info
More info in DOCS.
Development
npm installTo build for production, run:
npm run buildTo run the unit tests for the components, run:
npm testYou'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
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago