npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yocto-utils

v2.2.0

Published

Utility tools for : cryptography, date, media, object, strings

Downloads

40

Readme

NPM

alt text Code Climate Test Coverage Issue Count Build Status

Overview

This module is a part of yocto node modules for NodeJS.

Please see our NPM repository for complete list of available tools (completed day after day).

This module provide utility function for various domains (encryption, media, string, date, object and more others)

Motivation

After each development, conclusion is the same : we need to create an utility tools with all our utility method to be able to reuse them in other program. That's why we create this utility tools.

Although this module was completed day after day.

Available modules

See method list for each available method

  • Crypto : for utility functions related to encryption (random password, encrypt, decrypt, etc..)
  • Media : for utility functions related to media
  • Request : for utility functions related to request (get http info - host - x-forwarded, etc ...)
  • Strings : for utility functions related to string
  • YDate : for utility functions related to date
  • Object : for utility functions related to object manipulation

Method list

  • Module Crypto :
    • randomizedPassword(length, complexity) : generate a random password with a specific complexity
    • encrypt(key, value) : encrypt given string to an AES-256 representation with given key
    • decrypt(key, value) : decrypt given AES-256 representation string value with given key
  • Module Date :
    • generateList(min, max, prefixMin, prefixMax, reverse) : Generate a list of date between two given index
    • getElapsedTime(config, time) : Get elapsedTime between current time to given time
  • Module Media :
    • isValidImageFormat(type) : Test is given image format is valid (only string extension for the moment)
  • Module Object :
    • renameKey(obj, key, newKey) : rename a given key for another given
    • underscoreKeys(o) : rewrite all base object key name to an underscore key name (FULL depth level)
    • underscorizeKeysMongoose(o) : rewrite all base object key name to an underscore key name (FULL depth level) of an Mongoose object
    • inspect(value, colorize : get the current object to a string representation with a full depth
    • camelizeKeys(o) : rewrite all base object key name to an underscore key name (FULL depth level)
    • camelizeKeysMongoose(o) : rewrite all base object key name to an underscore key name (FULL depth level) of an Mongoose object
  • Module Request :
    • getHost(request) : Get current host name from express request object
  • Module Strings :
    • generateAsciiCharsList(alpha, num, special, toLower) : Generate an list of chars from ascii table
    • isUppercase(char) : test if a given char is to uppercase
    • isLowercase(char) : test if a given char is to lowercase
    • camelCase(string) : camelize a string
    • underscore(string) : underscore a string
    • isSpecialChar(char) : check is a given char is a special char

Logging in tool

By Default this module include yocto-logger for logging.

How to use

Each module is available like : utils.<MODULE_NAME>.<WANTED_METHOD_NAME>(PARAMS, ...)

var utils = require('yocto-utils')();

// For Crypto module
utils.crypto.<METHOD_NAME>

// For Date module
utils.date.<METHOD_NAME>

// For Media module
utils.media.<METHOD_NAME>

// For Object module
utils.obj.<METHOD_NAME>

// For Request module
utils.request.<METHOD_NAME>

// For Strings module
utils.str.<METHOD_NAME>

Or you can retreive module by getter method : utils.get('module_name')


// For Crypto module
utils.get('crypto').<METHOD_NAME>

// For Date module
utils.get('date')<METHOD_NAME>

// For Media module
utils.get('media')<METHOD_NAME>

// For Object module
utils.get('obj')<METHOD_NAME>

// For Request module
utils.get('request')<METHOD_NAME>

// For Strings module
utils.get('str')<METHOD_NAME>

Examples

Examples are available in example directory in git repository.

Next step

  • Other utilities function