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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aitutils

v0.1.14

Published

This library contains common utilities used in Assign It To Us projects and products.

Downloads

11

Readme

Assign It To Us Utilities (aitutils)

This library contains common utilities used in Assign It To Us projects and products.

Library

The library covers 8 general areas

  1. Array
  2. Configuration
  3. Data
  4. File
  5. General
  6. Logging
  7. Parsing
  8. XML

To Install

To add this library to your project:

npm install aitutils --save

To use it

aitutils = require("aitutils").aitutils

API

Array

aitutils.array.isArrayOfObjects(object)

returns boolean

Check if an array is an array of objects.

Configuration

Loads a CSON configuration file and returns it as an object.


aitutils = require("aitutils").aitutils

config = aitutils.configuration.load("path/to/config.cson")

# you can also access the config again using the current property
current = aitutils.configuration.current

aitutils.configuration.load(path)

returns object

Data

Handles a variety of data formats.

This is currently Work-In-Progress.

File

Synchronous file tools.

aitutils.file.cleanPath(filePath)

returns string

Cleans up a file path by removing extra slashes, etc.

aitutils.file.ensureExtension(filePath, ext)

returns string

Ensures that the filePath has ext, if not, it is added to it. The extension should have a period in it.

console.log aitutils.file.ensureExtension("somefile.txt",".xls")

# somefile.txt.xls

aitutils.file.open(file)

returns string

Opens a file.

aitutils.file.save(file,data)

returns nothing

Saves data to a file.

aitutils.file.append(file, data)

returns nothing

Adds data to an existing file

aitutils.file.del(file)

returns nothing

Deletes a file.

aitutils.file.exists(file)

returns boolean

Checks if a file/folder exists.

aitutils.file.copy(source, destination, clobber)

returns nothing

Copies a file from one place to another. If clobber is provided and true, overwrites file.

aitutils.file.move(source, destination, clobber)

returns nothing

Moves a file from one place to another. If clobber is provided and true, overwrites file.

aitutils.file.isFolder(path)

returns boolean

Checks if a path is a folder.

aitutils.file.newFolder(path)

returns nothing

Creates a new folder.

aitutils.file.traverse(path, callback)

returns boolean

Walks a folder's structure and performs a callback on each item.

aitutils.file.setupFolderTree(subfolders)

returns boolean

Passed an array of paths, the function creates all folders in the array.

General

Other miscellaneous functions.

aitutils.general.dateSid(format)

returns string

Returns a numeric formatted date YYYYMMDDhhmmss.

You can override the default format by passing a string as the format parameter. The format should use Moment.js's conventions.

Logger

Simple console logger.

Types:

  • debug
  • info
  • error
  • warn
  • bot
  • shell
  • exec
  • stub
  • todo
  • sql

aitutils.logger.type("message")

returns nothing

Examples:

aitutils = require('aitutils').aitutils

aitutils.logger.debug "This is a debug message"

aitutils.logger.info "This is an info message"

aitutils.logger.error "This is an error message"

aitutils.logger.warn "This is a warn message"

aitutils.logger.bot "This is a bot message"

aitutils.logger.shell "This is a shell message"

aitutils.logger.exec "This is an exec message"

aitutils.logger.stub "This is a stub message"

aitutils.logger.todo "This is a todo message"

aitutils.logger.sql "This is an sql message"

Parse

This library is a work in progress.

XML

aitutils.xml.tidy(xml)

returns string

Tidies up XML.

aitutils.xml.reduce(obj)

returns object

Reduces an xmlLite object into something usable.

aitutils.xml.fromJadeFile(jadepath,locals)

returns string

Compiles a jade file into xml.

aitutils.xml.fromJade(jadeMarkup,locals)

returns string

Compiles a jade string into xml.

aitutils.xml.toJadeFile(xml, path)

returns nothing

Converts XML markup into a Jade file.

aitutils.xml.toJade(xml)

returns string

Converts XML markup into Jade markup.