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

english-verbs-helper

v3.3.0

Published

English verbs conjugation

Downloads

2,140

Readme

English verbs conjugation

Features

Agreement of English verbs, based on a few rules and on linguistic resources.

You have to import and provide independently linguistic resources:

  • use english-verbs-irregular for a list of irregular verbs (with their preterit and past participle)
  • use english-verbs-gerunds for a list of irregular gerunds (ing)

These resources are not declared as dependencies so that they are not automatically bundled in a browser package.

If you do not provide linguistic resources, very basic rules will be used: adding ing for gerunds, and ed for past and participles.

Usage

getConjugation will return the conjugated verb based on:

  • information about irregular verbs (preteric, past participle and gerund):
    • you can just put null if you don't care about irregular verbs, or if your tenses don't require them (only SIMPLE_PRESENT and SIMPLE_FUTURE)
    • other provide irregular verbs info, using english-verbs-irregular, and/or english-verbs-gerunds, using the provided helper mergeVerbsData
  • the verb as a string
  • the tense
  • the person: 0=I, 1=you (singular), 2=he/she/it, 3=we, 4=you (plural), 5=they.
  • ExtraParams:
    • for SIMPLE_FUTURE, you can add { GOING_TO: true } to trigger the going to form; default is { WILL: true }
    • use { NEGATIVE: true } to trigger the negative form; additionnaly add CONTRACT: true to get the contracted version (will not => won't, etc.); when using the verb to have, you can choose whether to generate hasn't or does not have using NO_DO: true

Available tenses are: SIMPLE_PAST (or PAST), SIMPLE_PRESENT (or PRESENT), SIMPLE_FUTURE (or FUTURE), PROGRESSIVE_PAST, PROGRESSIVE_PRESENT, PROGRESSIVE_FUTURE, PERFECT_PAST, PERFECT_PRESENT, PERFECT_FUTURE, PERFECT_PROGRESSIVE_PAST, PERFECT_PROGRESSIVE_PRESENT, PERFECT_PROGRESSIVE_FUTURE.

mergeVerbsData will simply combine irregular verbs info and gerunds, to be used in getConjugation. In practice you will have swim: ['swam', 'swum', 'swimming'], here combining an irregular preterit, past participle and gerund. Parameters:

  • VerbsIrregularInfo: use english-verbs-irregular, or null (irregular verbs are only required for some tenses)
  • GerundsInfo: use english-verbs-gerunds, or null (gerunds are only required for some tenses)

Limitations

  • no interrogative form
  • modals

Installation

npm install english-verbs-helper

Usage

const EnglishVerbs = require('english-verbs-helper');
const Irregular = require('english-verbs-irregular/dist/verbs.json');
const Gerunds = require('english-verbs-gerunds/dist/gerunds.json');

const VerbsData = EnglishVerbs.mergeVerbsData(Irregular, Gerunds);

// (he/she) eats
console.log(EnglishVerbs.getConjugation(null, 'eat', 'PRESENT', 2));

// (he/she) ate
console.log(EnglishVerbs.getConjugation(VerbsData, 'eat', 'SIMPLE_PAST', 2));

// swimming
console.log(EnglishVerbs.getIngPart(VerbsData, 'swim'));