New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ninja-util

Package Overview
Dependencies
Maintainers
7
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ninja-util

Helper library to develop Node.JS applications

  • 1.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42
increased by13.51%
Maintainers
7
Weekly downloads
 
Created
Source

Ninja-Util

This library has a set of helper classes and functions that are shared by our application following common patterns that we use on them. We mostly use MVC, SOLID and Observer Pattern.

Callback

Wraps a callback to be executed, check if it is a valid function and execute without exceptions.

const {Callback} = require("ninja-util");
Callback.invoke(aCallback); 

Express Wrapper

Wraps the http methods from the express and automatically set the response based on the callback invoked by the application

Examples:


const { ExpressWrapper } = require ('ninja-util');

Heap

TODO

Logger

Useful to logs the application to make easier to turn on and turn off logs.

TODO: document

Memory

const Memory = require("ninja-util/memory");
checkMemory([log])

NOTE: Node only

Logs the memory from the node application

Example:

memory.checkMemory("now")

Posibble Output:

now 5.5186767578125
compreensiveBytes(bytesCount)

Example

console.log(memory.compreensiveBytes(42))
console.log(memory.compreensiveBytes(42000))
console.log(memory.compreensiveBytes(42000000))

Output:

42b
41.02kb
40.05mb
getCurrentMemory([asNumber])

Returns the current footprint from the node application. If asNumber is set true, it will return in a number as bytes. Otherwise, it will convert using the compreensiveBytes, default is false.

Example:

 memory.getCurrentMemory()
 memory.getCurrentMemory(true)

Possible Output:

5.84mb
6244264

Observer

TODO

Promisify

TODO

SyncClient

TODO

SyncServer

TODO

Timer

TODO

FAQs

Package last updated on 04 May 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc