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

datran-es6

v0.1.6

Published

My custom datran module rewrite in ES6 babel npm package boilerplate

Downloads

20

Readme

Build Status

Thanks to NodeJS module generator/boilerplate.

Features

  • Babel - Write next generation JavaScript today;
  • Jest - JavaScript testing framework used by Facebook;
  • ESLint - Make sure you are writing a quality code;
  • Prettier - Enforces a consistent style by parsing your code and re-printing it;
  • Flow - A static type checker for JavaScript used heavily within Facebook;
  • Travis CI - Automate tests and linting for every push or pull request;
  • Documentation - A documentation system so good, you'll actually write documentation.

Install

The easiest way to use nod is through the npm.

$ npm install datran-es6 --save # or yarn add datran-es6

Commands

$ npm test # run tests with Jest
$ npm run coverage # run tests with coverage and open it on browser
$ npm run lint # lint code
$ npm run docs # generate docs
$ npm run build # generate docs and transpile code
$ npm run watch # watch code changes and run scripts automatically
$ npm run patch # bump patch version and publish to npm e.g. 0.0.1
$ npm run minor # bump minor version and publish to npm e.g. 0.1.0
$ npm run major # bump major version and publish to npm e.g. 1.0.0

Change logs

  1. Test method: Switch from jest to mocha, fixed async/await to run test in mocha.

API

Table of Contents

serializer

Output serializer & composer

parser

Field parser

scope

Root scope

serialize

Parameters

  • data any
  • scope any {identifier, resource}
    • scope.identifier
    • scope.resource

This function says hello.

Parameters

  • name Some name to say hello for.

Returns any The hello.

create

Parameters

  • resourceType
  • options any Optional parameters- exlcudes: Exclude string (eg req.query.exclude)
    • includes: Include string (eg req.query.include)
    • serializer
    • parser (optional, default {})
  • resource any instance of the resource type (Collection|Item)

item

Creates an item resource

Parameters

  • model any
  • transformer any

collection

Creates a collection resource

Parameters

  • model any
  • transformer any

Parser

Fields parser

Format

  • post,post.comments,post.author
  • post:limit(5):order(created_at|desc),-post.comments
  • post,-votes

Parameters

  • fields

separator

Character used to separate parameters

includes

Included fields

excludes

Fields to exclude

parameters

Included fields paramters

parse

Parses includes and exclude fields

Returns Parser

constructor

Constructor

Parameters

  • options Object includes: Requested includes (optional, default {})

createScope

Creates a child scope that is nested from current scope

Parameters

  • identifier String Child scope identifier
  • resource any Instance of resource type

Returns Scope

isRoot

Checks if this scope is the root scope

Returns Boolean

isIncluded

Checks if an identifier is included from current scope

Parameters

  • identifier any

isExcluded

Checks if an identifier is excluded from current scope

Parameters

  • identifier any

getPath

Gets the scope identifier path

Returns String

getIdentifier

Get scope (include) identifier

Returns any scope identifier

toPath

Parameters

  • includeIdentifier any

serializer

Default Serializer

collection

Serializes a collection

Parameters

  • key any
  • data any

item

Serializes a resource item

Parameters

  • key any
  • data any

empty

Serialize an empty resource

Returns Object

embedIncludes

Embeds the includes data to the transformed data

Parameters

  • data any
  • includeData any

item

Helper for creating an Item resource

Parameters

  • model any
  • transformer any

collection

Helper for creating a Collection resource

Parameters

  • model any
  • transformer any

hasIncludes

Checks if the transformer has any includes defined

Returns Boolean

create

Creates a new transformer blueprint using object pattern

Parameters

  • proto any

License

MIT © Diego Haz