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

arc-lib

v8.2.1

Published

ARC

Downloads

7,682

Readme

arc-lib

A convenience wrapper around my ARC utilities

Install

$ npm install arc-lib --save

Wraps

Exports

{
    is,
    ArcArray,
    ArcCheck,
    ArcDate,
    ArcEvents,
    ArcObject,
    ArcRegExp,
    ArcRouter,
    ArcHash,
    ArcScheduler
}

Random Utilities

  • arc-is: Is a simple type checker that honors inheritence, checks most native types properly, and has two modes to check between strict types vs soft types. To use simply: is(val) === 'array'
  • arc-check: Is a complex inclusion/exclusion check.
  • arc-events: A relatively standard on/emit events model, with some additional features ie. .once, .catchAll as well as a mixin to turn any object into an even emitter.
  • arc-router: Is a very thin functional router, for complex URL/Path mapping. It takes a map of urls or paths, and is able to take an evaluation string, and map it to a match while also pulling appropriate variables from the path.
  • arc-hash: Provides a very simple but consistent approach to generating md5 and sha256 hashes for both scalar and non-scalar types in javascript (objects and arrays in particular).
  • arc-scheduler: A scheduler and task manager for recurrent tasks. Supports both event based reaction (ie. NEW_HOUR / NEW_DAY / NEW_WEEK) as well as a fully managed task-scheduling suite (ie. Fire a job on the first Monday of every month at 8:00am)

Type Utilities

  • arc-array: Is a native array wrapper with a number of convenience methods such as: .shuffle, .rand, .pMap (asynchronous mapping)
  • arc-object: Is a native object wrapper with convenience methods such as .copy (which performs a deep copy), .freeze (make it immutable), and some array like functions.
  • arc-reg-exp: Is a native object wrapper around RegExp that exposes some convenience methods, such as .matchAll, .matchAndReplace, .replaceCallback
  • arc-date: Is a very thin Date formatting utility

Example Usage

const {is,ArcRouter,ArcEvents} = require('arc-lib');

//Pretend we're useful useful
const SomeViewController = {};

//Use ArcEvents to mixin events on the object
ArcEvents.mixin(SomeViewController);

//Bind an event
SomeViewController.on('validPath',(_path,_id)=>{
    console.log(_path,_id);
});

//Setup a functional router
const SomeRouter = new ArcRouter({
    '/some/**path[/]/#id':'validPath'
});

//Travel a path
const routeData = SomeRouter.travel('/some/resource/path/75');

//We should match
if(routeData.match){
    //Path in the resolved path and id from the path
    SomeViewController.emit(routeData.match,[routeData.path,routeData.id]);
}

//Will console.log('resource/path',75) by trigger the validPath event