npm.io
2.1.1 • Published 5 years ago

tense-builder

Licence
ISC
Version
2.1.1
Deps
0
Size
18 kB
Vulns
0
Weekly
0

Tests

Tense Builder

Instalation

npm i tense-builder -S

Usage

Parse mode
const TenseBuilder = require('tene-builder')
const tenseBuilder = new TenseBuilder()
tenseBuilder.config.space = '-'

const result = tenseBuilde.build('places-or-regions-with-hot-climate-and-low-racism-ubicated-in-romania-or-barcelona')

console.log(result)

// output is:
/*
[
    {
        word: 'places',
        type: 'subject',
        mood: 'or',
    },
    {
        word: 'regions',
        type: 'subject',
        mood: 'or',
    },
    {
        word: 'hot climate',
        type: 'what',
        mood: 'and',
    },
    {
        word: 'low racism',
        type: 'what',
        mood: 'and',
    },
    {
        word: 'romania',
        type: 'where',
        mood: 'or',
    },
    {
        word: 'barcelona',
        type: 'where',
        mood: 'or',
    },
]
*/
Build mode
const TenseBuilder = require('tene-builder')
const tenseBuilder = new TenseBuilder()

tenseBuilder.config.space = '-'

const parts = [
    {
        word: 'places',
        type: 'subject',
        mood: 'or',
    },
    {
        word: 'regions',
        type: 'subject',
        mood: 'or',
    },
    {
        word: 'hot climate',
        type: 'what',
        mood: 'and',
    },
    {
        word: 'low racism',
        type: 'what',
        mood: 'and',
    },
    {
        word: 'romania',
        type: 'where',
        mood: 'or',
    },
    {
        word: 'barcelona',
        type: 'where',
        mood: 'or',
    },
]

const result = tenseBuilde.build(parts)

console.log(result)
// output is: 
/*
    "places-or-regions-with-hot-climate-and-low-racism-ubicated-in-romania-or-barcelona"
*/
Types

"subject" your subject

"what" for stuff

"whatNegative" for negate stuff

"where" for ubications

Moods

"or" / "and"