🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

nemjs

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

nemjs

JavaScript Backend Services Library

2.1.3
unpublished
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

nemjs

JavaScript Backend Service Library

NPM Version

NPM Downloads GitHub Last Commit

Codacy Badge Maintainability

GitHub Top Language Code Size

Overview

nemjs is a JavaScript Backend Service Library.
You will find some Services about Checkers, Getters & Setters
Auth services are using JWT & bcrypt
Mail services are using nodemailer
Image services are using sharp

Summary

Package

NPM : npm i nemjs
Yarn : yarn add nemjs

Download

Latest Release
or
git clone https://github.com/philippebeck/nemjs.git
or
Master ZIP

Content

Checkers part :

  • checkAuth(req, res, next) : check JWT auth to routes
  • checkEmail(email) : check email validity
  • checkPass(pass) : check password validity
  • checkRange(value, min, max) : check number|string range with min/max
  • checkUrl(url) : check url validity

Getters part :

  • getName(name) : get kebab-case name
  • getPosterName(name) : get image name for gallery cover
  • getMailer() : get mailer with nodemailer
  • getMessage(message) : get message
  • getPassword() : get generated password

Setters part :

  • setAuth(pass, user, res) : set JWT
  • setImage(inputImg, outputImg, width, height) : set image
  • setThumbnail(inputImg, outputImg, width, height) : set thumbnail

Usage

  • Copy the .env.example file to your project root, rename it .env & replace values with your own values
  • Add const nem = require("nemjs") where you need (file or function top level)
  • Then use it like in these examples :
    • router.get("/", nem.checkAuth, UserCtrl.list)
    • nem.setAuth(guest.password, user, res)
    • if (nem.checkEmail(guest.email)) { ... }
    • if (nem.checkRange(guest.name)) { ... }
    • if (nem.checkPass(guest.password)) { ... }
    • const pass = nem.getPassword();
    • if (nem.checkUrl(item.url)) { ... }
    • nem.setImage(uploadImage, newImage);
    • nem.setThumbnail(uploadImage, newImage);
    • const mailer = nem.getMailer()
    • let message = nem.getMessage(req)

Tests

You can run unit tests with Jest :
NPM : npm test
Yarn : yarn test

Keywords

javascript

FAQs

Package last updated on 24 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts