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

wrixjs

v1.0.3

Published

WrixJS is builded whit WrixJS: a Javascript lib to compose chainable libs and frameworks.

Downloads

6

Readme

wrixJS

WrixJS is builded whit WrixJS: a Javascript lib to compose chainable libs and frameworks.

You will like it if:

  • you don't like to declare vars only to configure props object
  • you fear to forget 'return this' at the end of every function of your chainable lib (or you're too lazy...)
  • you don't like to (always) clone objects
  • you like to extend functionality preserving the original instance
  • you like clean, readable code
  • you need to build factories/services in an easy way

Installation

  • Install node.js and npm: https://nodejs.org/en/
  • Run

npm install wrixjs

Usage

wrix

  • wrix(object, istantiate = true)
import { wrix } from wrixJS

const example = {
  x:1,
  y:1,
  sum(){
    return this.x + this.y
  }
}
// wrap new instances
let wrixExample = wrix(example) // same as wrix().wrap(Object.create(example)).wrix()
console.log(wrixExample.x(2)
                       .y(4)
                       .sum()) // 6
console.log(example.y) // 1
import { wrix } from wrixJS

// wrap uninstantiated object
let wrixExample = wrix(example, false) // same as wrix().wrap(example).wrix()
console.log(wrixExample.x(2)
                       .y(4)
                       .sum()) // 6
console.log(example.y) // 4

DOCUMENTATION TO DO:

  • wrix.wrap()
  • wrix.compose()
  • wrix.set()
  • wrix.consume()
  • wrix.wrix()

wrixFactory

  • wrixFactory(configurationObject)

configutationObject has these properties:

  • key: key to register/get/destroy the factory
  • type: type of factory function: object, class, prototype, static (default: object)
  • keyContext: prop name to access wrapped instance (default: key)
  • factoryFn: function to pull instances to wrap
  • factoryArgs: list of args to pass to the factory function (optional)
  • behaviours: list of methods(wrappedInstance, wrapper) to add to the wrapper (optional)
import { wrixFactory } from wrixJS
import Foo from './foo'
const example = {
  x:1,
  y:1,
  sum(){
    return this.x + this.y
  }
}

wrixFactory()
  .create({
    key: 'example',
    factoryFn: example
  })
  .create({
    key: 'foo',
    factoryFn: Foo,
    type: 'class'
  })
// get instance of wrix(example) with configuration
let wrappedExample = wrixFactory().get('example', { x: 1, y: 3 })
// get a new Foo() wrapped in a wrix()
let wrappedFoo = wrixFactory().get('foo')
console.log(wrappedExample.x(2).sum()) // 5
import { wrixFactory } from wrixJS

const example = {
  x:1,
  y:1,
  sum(){
    return this.x + this.y
  }
}
const configFactory = {
  key: 'foo',
  factoryFn: example
}

wrixFactory(configFactory) // same as wrixFactory().create(configFactory)
let wrappedFoo = wrixFactory().get('foo', { x: 1, y: 3 })
console.log(wrappedFoo.sum()) // 4
let otherWrappedFoo = wrixFactory().get('foo')
console.log(otherWrappedFoo.sum()) // 2

DOCUMENTATION TO DO:

  • wrixFactory.create()
  • wrixFactory.get()
  • wrixFactory.keys()
  • wrixFactory.destroy()
  • wrixFactory.destroyAll()

Contribute

Clone this repo:

Navigate into your workspace directory.

Run:

git clone https://github.com/wideLandscape/wrixJS

Install dependencies:

Navigate to the cloned repo's directory.

Run:

npm install

Building

  • npm run dev - dev build with sourcemaps
  • npm run build - production build
  • npm run dist - production build + source code as you can see in the 'dist' folder.

Testing

  • npm run test:self - a pass/no pass test to ensure mocha/chai works properly
  • npm test - runs tests

Authors

Version History

  • 1.0.3
    • workaround for webpack 4 issue: https://github.com/webpack/webpack/issues/6522
  • 1.0.2
    • the dist folder contains:
      • wrix.js: the webpacked lib;
      • src/ folder: wrixJS source code, no minify/uglify. Easy to debug when building your own lib/framework . Recommended.
  • 1.0.1
    • fix wrix()
    • README.md update
  • 1.0.0
    • split wrix into wrixFactory() and wrix()
    • add type to wrixFactory's configurationFactoryObject (object, class, static, prototype)
    • wrix(object) is a shortcut for wrix().wrap(Object.create(object)).wrix()
    • wrixFactory(configurationFactoryObj) is a shortcut for wrixFactory().create(configurationFactoryObj)
    • add destroy(instance) destroyAll() methods and 'keys' prop to wrixFactory
  • 0.4.0
    • add more control over wrix wrap/compose process
  • 0.3.0
    • wrix utility library is ready
  • 0.2.0
    • Test Coverage
  • 0.1.0
    • Initial Release

License

This project is licensed under the MIT License - see the LICENSE file for details