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

sinew

v1.0.2

Published

██████ ██▓ ███▄ █ ▓█████ █ █░ ▒██ ▒ ▓██▒ ██ ▀█ █ ▓█ ▀ ▓█░ █ ░█░ ░ ▓██▄ ▒██▒▓██ ▀█ ██▒▒███ ▒█░ █ ░█ ▒ ██▒░██░▓██▒ ▐▌██▒▒▓█ ▄ ░█░ █ ░█ ▒██████▒▒░██░▒██░ ▓██░░▒████▒░░██▒██▓ ▒ ▒▓▒ ▒ ░░▓ ░ ▒░ ▒ ▒ ░░ ▒░ ░░

Downloads

3

Readme

  ██████  ██▓ ███▄    █ ▓█████  █     █░
▒██    ▒ ▓██▒ ██ ▀█   █ ▓█   ▀ ▓█░ █ ░█░
░ ▓██▄   ▒██▒▓██  ▀█ ██▒▒███   ▒█░ █ ░█ 
  ▒   ██▒░██░▓██▒  ▐▌██▒▒▓█  ▄ ░█░ █ ░█ 
▒██████▒▒░██░▒██░   ▓██░░▒████▒░░██▒██▓ 
▒ ▒▓▒ ▒ ░░▓  ░ ▒░   ▒ ▒ ░░ ▒░ ░░ ▓░▒ ▒  
░ ░▒  ░ ░ ▒ ░░ ░░   ░ ▒░ ░ ░  ░  ▒ ░ ░  
░  ░  ░   ▒ ░   ░   ░ ░    ░     ░   ░  
      ░   ░           ░    ░  ░    ░    

sinew

command-line-interface-tools

API

Table of Contents

helpWithOptions

Convert a yargs-parser object and a config into a help string

Parameters
  • conf object a configuration object
  • argv object a yargs-parser parsed argv

Returns string formatted string

readRaw

fs.readFile but curried

Parameters
  • path string path-to-a-file
  • format string file format
  • callback function standard nodeback style callback
Examples
import { readRaw } from "sinew"
import { pipe, map, __ as skip } from "ramda"
import { node } from "fluture"

export readFileAndDoStuff = pipe(
  pipe(
    readRaw(skip, 'utf8'),
    node
  ),
  map(x => "preamble:\n" + x)
)

Returns any null

readUTF8

fs.readFile but curried and with utf8 format chosen

Parameters
  • path string path-to-a-file
  • callback function a node-style nodeback function
Examples
import { readUTF8 } from "sinew"
import { pipe, map, __ as skip } from "ramda"
import { node } from "fluture"

export readFileAndDoStuff = pipe(
  pipe(
    readUTF8(skip),
    node
  ),
  map(x => "preamble:\n" + x)
)

Returns string a future value of a string

readFile

fs.readFile but utf8 and returning a Future

Parameters
Examples
import { readFile } from "sinew"
import { pipe, map } from "ramda"

export readFileAndDoStuff = pipe(
  readFile,
  map(x => "preamble:\n" + x)
)

Returns Future<string> a future value of a string

writeRaw

fs.readFile but curried; arity 4

Parameters
  • path string path-to-a-file
  • data any data to write to a path
  • format (string | object) format or opts
  • callback function a nodeback-style callback function
Examples
import {writeRaw} from "sinew"
writeRaw("my-file.md", "cool", "utf8", (e) => {
  if(e) console.warn(e)
  // done
})

writeRaw

fs.readFile but curried; format utf8

Parameters
  • path string path-to-a-file
  • data any data to write to a path
  • callback function a nodeback-style callback function
Examples
import { writeUTF8 } from "sinew"

writeUTF8('my-file.md', 'cool', (e) => {
  if(e) console.warn(e)
  // done
})

writeFile

Write a utf8 file and wrap the action in a future

Parameters
Examples
import { writeFile, readFile } from "sinew"
import { curry, pipe, map, chain } from "ramda"

const prepend = curry((pre, file, data) => pipe(
  readFile(file),
  map(raw => pre = raw),
  chain(writeFile)
))

Returns Future<string> a future-wrapped value(?)

is

expect(actual).toEqual(expected) but curried

Parameters
  • expected any an expected value
  • actual any the actual value

Returns boolean

matches

expect(actual).toMatchSnapshot alias as a unary function

Parameters
  • x any a value

Returns boolean a boolean value

testCLI

A simplified way of testing asynchronous command-line calls using execa.shell Designed for jest testing

Parameters
  • cli Array<string> commands and flags to pass to execa
  • testName string the name of your test
  • assertion function an assertion function. receives actual value as only param

testCLI

A simplified way of testing asynchronous command-line calls Designed for jest testing

Parameters
  • cli Array<string> commands and flags to pass to execa
  • testName string the name of your test
  • assertion function an assertion function. receives actual value as only param