This is a library that provides code utilities for social media applications. Some utilities it provides are as follows:
- A method
getMixedFeedPosts
that mixes posts a user created and posts that user has liked in an alternating fashion. It runs in linear time. - A method
mixByOwners
that mixes posts created by various users in a round robin fashion. It runs in linear time.
- This is an es6 based program
- The code is heavily documented with
jsdoc
and has strongjsdoc typing
. - The code uses
carmel and pascal case
, a style heavily used in javascript development as compared tounderscore case
in php and python - It efficiently uses a mixture of composition and inheritance to implement data abstraction and make the code more cohesive. For example, the
mysql/posts/posts.js
is a mysql based extension of a more generalizedmodels/posts/base-posts.js
.
In the models/posts/mixed-posts.js
class, The methods mixByOwners()
and getMixedFeedPosts()
use the method mixBy()
which runs in O(N) time. More details can be found in program documentation.
- install dependencies using
npm install
- create a test database and run all queries in
tests/db.sql
to build the database schema. Be warned that any information in the test database can be deleted at any time. - set mysql connection details in
tests/connection.js
- run the tests using
npm run test