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

chryformer

v0.1.3

Published

The best module ever.

Downloads

3

Readme

NPM version Build Status Dependency Status

Basic transformer for use with chrysalis.

Install

$ npm install chryformer --save

Usage

The chryformer is the basic transformer for use with chrysalis - 'githublink@here' chryformer supports a simple map strategy designed to effortlessly transform a collection of source objects to a collection of new objects of a unique scheme.

###Initialization It is required to initialize the chryformer with a Mapper. A mapper can be an object mapping the keys on the source object to the desired keys on the destination object or an iteratee function that will be run on each item in the source collection.

  • Refer to [https://github.com/wankdanker/node-object-mapper] for examples on what a mapper object can look like
  • Refer to [https://lodash.com/docs#map] for examples on what a mapper function can look like
var Chryformer = require('chryformer');
var Chrysalis = require('chrysalis');

var map = {
  sourceKey1: 'destinationKey1',
  sourceKey2: 'destinationKey2'
};
var chryformer = Chryformer(map);

var chrysalis = Chrysalis();
chrysalis.setTransformer(chryformer);

#API

  • chryformer.setFilter (filter) - Sets the filter strategy to be used by the chryformer.
    • filter (Object|Function|String) - The function invoked per iteration. See [https://lodash.com/docs#filter]
  • chryformer.setReducer (reducer) - Sets the reducer strategy to be used by the chryformer
    • reducer (Function) - The function invoked per iteration. See [https://lodash.com/docs#reduce]
  • chryformer.transform (inputData) - Transforms the input data based on the filter, mapper, and reducer.
    • inputData (Array|Object) - An single object or array of source objects that will be transformed. If you are using Chrysalis, this will be fed the output from your extractor.

#Example

var input = [{
  name: 'Fred',
  age: 35
}, {
  name: 'Barney',
  age: 32
}, {
  name: 'Pebbles',
  age: 6
}];

var mapObj = {
  name: 'firstName',
  age: 'age'
};

var transformer = chryformer(mapObj);
transformer.setFilter(function(data) {
  return data.age > 30;
});

chryformer.transform(input);
// -> [{firstName: 'Fred', age: 35}, {firsName: 'Barney', age: 32}]

License

MIT © APPrise-Mobile