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

wizkit

v1.8.3

Published

The functional programming programming utility and terminal logger.

Downloads

123

Readme

Wizkit

A functional programming utility kit with a robust logger for the terminal and browser.

Author: Robert Edward Steckroth II


var up = new Wizkit("Example 1").set_option({"debug": "verbose"})


up.sp("The first instance of Wizkit will store the default settings for the others.")
  .line("Here are the configurable settings:", up.mutable_options).log()

up.log("Calling log with multiple arguments", "will use the", "last known",
  "separator (a space is the default).")

var cont = up.line("Adding lines is easy now").log("These use the last known", "separator (a line now)")
cont.log("We can continue form any point including..", "..log() call.")


// A new copy of the logger is created every time a logging command is called form the base class.
var log_1 = up.sp("Instance one of the logger.")
var log_2 = up.sp("Instance two of the logger.")
log_1.log()
log_2.log()

log_1.log("This is called again after the first time sense the original text is strored in the logger instance created by the parent class.")
log_1.clear().log("The logger can have its text cleared with the clear() command.")

var logger = up.sp("Some text for example sake.")

up.log("Wizkit also accepts itself as a logging potion other than text", logger)

up.log("The text() method will return a plain string instead of pretty logging ->", logger.text())

up.log("The contains_text property will tell us if the logger is holding anything (which can be cleared)",
  up.sp("Some text").contains_text, up.sp("Some text").clear().contains_text)

up.line("We can also specify objects").line(complex_object).log()

up.tab("the initial separator is ignored", "like the tab at the", "beginning of this line").log()

var complex_object = {"Test Object": [1,2,3,4,"Test String", {"obj in array": {test_array: ["deep", false, 234]}}]}

up.line("We can also specify objects").line(complex_object).log()
up.indentation_string = ">>"
up.log("..and change the the indentation_string option").log(complex_object)

up.compress_level = 4
up.set_option({indentation_string:  "-"})

up.line(" "," ").sp("..and compress the object").log("to level", up.compress_level, complex_object)
up.line().line().sp("..and compress the object").set_option({compress_level: 3}).log("to level", 3, complex_object)
up.line(" "," ").sp("..and compress the object").set_option({compress_level: 2}).log("to level", 2, complex_object)
up.line(" "," ").sp("..and compress the object").set_option({compress_level: 1}).log("to level", 1, complex_object)

var example_2 = up.new_copy("Example 2")
example_2.log("Example two was created with new copy and has the exact same options as example 1 but is uniquely threaded.",
  example_2.mutable_options)

var example_3 = new Wizkit(example_2, "Example 3")
example_2.log("Example three was created with the Wizkit constructor and passed a title as a string.",
  "It has the exact same options as example 2 but is uniquely threaded as well.", example_2.mutable_options)


var t_f = function(opt, cb, err) {

}

var my_func = function(opt, cb, err) {
  cb = up.cb(cb, this)
  err = up.error_cb(err, this)

  this.more = "no data yet.."

  if ( opt ) cb(up.sp("Calling success callback with prototype").line(this).line("----------------"))
  else err(up.sp("Calling error callback with prototype").line(this).line("----------------"))

}

var new_proto = { "more": "data" }


var cb_a = function() {
  this.Robert = "Bob"
  console.log("msg sent to Wizkit error callback: "+this.msg)
  up.sp("Prototype of callback -> ").line(this).log()
}
cb_a.prototype = {"cb_a permanent_data": "here"}

var cb_b = function() {
  this.Robert = "Bob"
  console.log("msg sent to Wizkit error callback: "+this.msg)
  up.sp("Prototype of callback -> ").line(this).log()
}
cb_b.prototype = {"cb_b permanent_data": "here"}

var test_callbacks = function() {

  cb_a = up.error_cb(cb_a, "msg for end user display") // msgs do no regard the debug state and are always availible
  cb_a("An internally generated error msg")

  cb_a = up.error_cb(cb_a, new_proto, "Prototypes can not be changed once they are set to a function.") // msgs do no regard the debug state and are always availible
  cb_a("An internally generated error msg with the same prototype initially assigned")

  up.error_cb(cb_a, new_proto, "A different msg for end user display")("An different internally generated error msg")

  cb_b = up.error_cb(cb_b, {"Custom_prototype": true}, up.sp("Wizkit logger is usefull here as well. This log will be sent regardless of the debug state."))
  cb_b()


  up.error_cb({"test": ["test data"], "up": up}, function() {
    this.up.sp("We got Wizkit from the prototype passed in:").sp(this.test).log()
  })()

  up.error_cb()("Simple error reporting through Wizkit")

}


var test_printing = function() {

  up.sp("cool").sp(null).sp(false).sp(y).sp("cool").sp(null).sp(false).sp(y).log("a"*3)

  var y
  up.log_app_name = "" // Turn off auto app printing
  var output = up.pass()
  output.set_option({use_color: false}).add("Starting empty").add().line().line().line()
  //assert(output.toString() === "Starting empty\n\n\n")

  up.tab("This starts at the beggining of line because the first separater is ignored").log()
  up.line("good").sp("deal").log()

  up.sp("one blank line separates").line().line("these two lines").log()

  up.sp().sp("one space before this").log()
  up.sp().sp().sp("two spaces before this").log()


//  up.line().set_option({use_color: false}).line().line().line(new Error("Wizkit will auto-print Errors"))
  //  .line().set_option({use_color: true}).line("In color now!").log(new Error("Wizkit will auto-print Errors"))


  up.tab("All separators are ignored when the first separator command is called (except lines)").log()

  up.line("Lines will newline even on the first command call").log()
  up.line().log()

  up.sp("Clear all of the data after this msg and log the last string").clear().line().tab("This is not printed").clear().tab("last chain after clear here").log()

  up.always().sp("Ignore the debugging state with the always command.").log()
  up.always().sp("Ignore the debugging state with the always command.").log()
  console.log(up.always().sp("Ignore the debugging state with the always command.").text())

  up.log_app_name = "Wizkit testing utility" // Turn on auto app printing

  up.log(function() {
    // print this function
    this.robert = "bob"
  })

}
function test_debug_state() {


  up.log_app_name = "Testing debug switches"

  up.debug = "verbose"
  up.sp("Debug state is set to", up.debug).log()
  up.error_cb()(up.always().sp("an error msg"))

  up.debug = true
  up.sp("Debug state is set to", up.debug).log()
  up.error_cb()("another an error msg")

  up.debug = false
  up.sp("Debug state is set to").sp(up.debug).log()
  up.error_cb()(up.always().sp("yet another error msg"))


}

test_printing()
test_callbacks()
test_debug_state()

Wizkit!

Wizkit!

Works in gecko based browsers

Wizkit! Wizkit!

Works in webkit based browsers

Wizkit!