A case for Blockchain on Kubernetes

Happenstance brought me in front of an enthusiastic, spirited, and ambitious duo of entrepreneurs who were running a fast-moving blockchain startup. Plagued by operations and latency woes, their…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Validation module in NodeJS

As the process of finding modules for a new project goes on, we go through a lot of libraries, discover many modules with a lot of dependencies and test them. Then we install package.json and get an error message, because NodeJS has a different version. We cry and start the search again.

Now we are working on the project cooklook.ru and using full-stack javascript. Our team stores everything in Docker. If we edit package.json or change docker file, Docker rebuilds the project. It lasts a few minutes, takes up a lot of memory and loads cpu to 100%. For modules such as express, it’s normal. But if you check “isEmail” or “isString” with min/max characters, you don’t want to pull 30 or more dependencies into your project (I saw a module with 2000 dependencies).

Our validation module was created to test the most necessary things without dependencies:
— isStr, check for a string with the minimum and maximum number of characters
— isEmail, email validation
— isInt, check for integer, with min/max
— isArr, check for an array, with min/max length of array
— isExist, check for undefined, null, NaN

Add a comment

Related posts:

How to Find Your Purpose In Your Business

One of the questions that comes through my inbox the most is how people can find their purpose. After they find their purpose, they wonder how to start a business from it like I have. While there is…

How I prepped for the interview

In this post I talk about the services of a couple organisations, so bear that in mind before you read it! I have not been asked by them to talk about it, so I promise this is my honest opinion on…

Trabajar no necesariamente debe ser solitario

Trabajar solo es en ocasiones hasta necesario, si quieres que el trabajo esté bien hecho hazlo tu mismo, pero no siempre debe ser así o al menos no de cierto modo. Por si no lo sabias, el humano por…