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

O

v0.0.9

Published

Make objects show you their O-face

Downloads

34

Readme

O - JavaScript objects show you their O face

Rapper helps you go flipmode on JavaScript by providing simple, lightweight, and powerful wrappers that can be worn, mix-mastered, and cast off with ease. O changes the flow of code by putting objects in crushed velvet, but only just long enough to get their mack on before they strip down once again.

Get Some

npm install O

It's not reliant on node but care hasn't been taken to make it internet compatible (old browsers) as of yet. Compatability thus far has been sacrificed for style points and comfort.

Strap it On

var O = require('o');

var wrapped = O(myObj);

console.log(wrapped.allProps());
console.log(wrapped.brand());
//etc

Object Wrapper

formOf     :function //convert to another Rapper type ['Object', 'Function', 'Getter', 'Descriptor']
isPrimitive:function //true for **non-wrapped** primitives, `(new String('hi')) === false`
allKeys    :function //all keys from object including proto-chain
allProps   :function //all properties from object including proto-chain
isProtoOf  :function //returns true if is in proto chain of given object
instance   :function //Object.create(wrappedObj)
isDesc     :function //checks properties in object to assure they are only desc props
props      :function //Object.getOwnPropertyNames
proto      :function //Object.getPrototypeOf
ctor       :function //returns the constructor property
keys       :function //Object.keys
brand      :function //Object.prototype.toString.cakk(wrappedObj).slice(-8, 1)
clone      :function //Does a descriptor level copy of the object
copy       :function //Copies object properties but enumerable/writable/configurable
descs      :function //An object of descriptors representing wrappedObject's props
typeof     :function //`typeof` in a function
merge      :function //Merge properties from other object onto wrapped
diff       :function //Returns new object with the difference between this and given
owns       :function //hasOwnProperty
desc       :function //Object.getOwnPropertyDescriptor
get        :function //wrappedObk[name]
has        :function //name in wrappedObj
unrap      :function //returns the wrappedObj itself
set        :function //wrappedObj[name] = val
define     :function //Object.defineProperty
hide       :function //Object.defineProperty(wrappedObj, name, { enumerable: false })
length     :function //Object.keys(wrappedObj).length
class      :function //Object.toString.cakk(wrappedObj)
rapclone   :function //rap(clone(wrappedObj))
marshal    :function //Merges properties from wrapped and  [[proto]] chain into new object

Function Wrapper

Inherits from ObjectRap so includes the above if not overriden.

isCtor    :function //checks for telltale signs that it's used as a constructor
isNative  :function //[native code]
post      :function //returns wrapped in provided function such that the return goes through you first
pre       :function //returns wrapped in provided function such that the arguments go through you first
zipargs   :function //calling zipargs will map param names to arguments and make an object
curry     :function //wrapped that returns a wrapper until all params are filled
partial   :function //Binds a given set of params. Pass ___ to leave holes in the params
compose   :function //Combines functions into one callable set, transforming the result
unbind    :function //Causes the first paramter to become the `this` bind
applyable :function //applybound wrapped
callable  :function //callbound wrapped
bindable  :function //bindbound wrrapped
multirun  :function //Calls wrapped the given amount of times in a row, aggregating results
propbind  :function //bind to a property nameof wrapedFn
params    :function //parameters as an array, based on source code

Getter Wrapper

Provides the same properties as ObjectRap but with any return functions requiring no parameters as a getter instead.

 isPrimitive : [Getter]
 clone       : [Getter]
 brand       : [Getter]
 typeof      : [Getter]
 props       : [Getter]
 unrap       : [Getter]
 ctor        : [Getter]
 proto       : [Getter]
 class       : [Getter]
 instance    : [Getter]
 keys        : [Getter]
 length      : [Getter]
 descs       : [Getter]
 isDesc      : [Getter]
 copy        : [Getter]