lesleys_hbs v1.0.7
lesleys_hbs
Instructions:
npm install lesleys_hbs
const helpers = require('lesleys_hbs')
const {
engine
} = require("express-handlebars")
const app = express();
app.engine('.hbs', engine({
extname: '.hbs',
helpers: helpers
}));
Example
{{countByCondition problem "status" "to do"}}
arrayOfObjectsHBSHelper.filterValues()
Kind: instance method of ArrayOfObjectsHBSHelper
Example
{{#filterValues problem "you" "whatshouldbe"}}
<div class="message">
<div class="content">
hi
{{problem}}<br />
{{whatshouldbe}}<br />
{{whatactuallyis}}<br />
{{hypothesis}}
</div>
</div>
{{/filterValues}}
arrayOfObjectsHBSHelper.sortAsc()
Kind: instance method of ArrayOfObjectsHBSHelper
Example
{{#sortAsc problem "seconds" "string"}}
{{problem}} {{whatshouldbe}}
{{/sortAsc}}
arrayOfObjectsHBSHelper.sortDesc()
Kind: instance method of ArrayOfObjectsHBSHelper
Example
{{#sortAsc problem "seconds" "string"}}
{{problem}} {{whatshouldbe}}
{{/sortAsc}}
arrayOfObjectsHBSHelper.contains(array, property) ⇒ array
Kind: instance method of ArrayOfObjectsHBSHelper
Returns: array - of objects
Date: 2022-02-17
Author: lezzles11 :) - www.github.com/lezzles11
Param | Type |
---|---|
array | array |
property | any |
Example
{{#arrContains problem "status" "doing"}}
<div class="message">{{problem}}
{{whatactuallyis}}
{{whatshouldbe}}
{{hypothesis}}{{plan}}</div>
{{/arrContains}}
arrayOfObjectsHBSHelper.doesNotContain()
Kind: instance method of ArrayOfObjectsHBSHelper
Example
{{#doesNotContain problem "status" "doing"}}
<div class="message">{{problem}}
{{whatactuallyis}}
{{whatshouldbe}}
{{hypothesis}}{{plan}}</div>
{{/doesNotContain}}
arrayOfObjectsHBSHelper.filterAndSort()
Kind: instance method of ArrayOfObjectsHBSHelper
Example
{{#filterAndSort problem 5 "hi" "problem" "string" true }}
{{problem}}
{{whatactuallyis}}
{{whatshouldbe}}
{{hypothesis}}{{plan}}
{{/filterAndSort}}
arrayOfObjectsHBSHelper.group()
group(array, "status")
Kind: instance method of ArrayOfObjectsHBSHelper
Example
group(array, "status")
HelpersCode
Kind: global class
new HelpersCode()
let helpersCode = new HelpersCode()
helpersCode.hbsPrintCode()
hbsPrintCode
Kind: instance method of HelpersCode
Example
{{hbsPrintCode '{{> core/isotopeButtons}}'}}
helpersCode.hbsPrintFile()
Kind: instance method of HelpersCode
Example
{{hbsPrintFileJS "buildComponents/button.js"}}
helpersCode.hbsPrintFileJS()
Kind: instance method of HelpersCode
Example
{{hbsPrintFileJS "buildComponents/button.js"}}
helpersCode.hbsPrint()
Kind: instance method of HelpersCode
Example
{{#hbsPrint}}
<span class="has-text-danger is-clickable icon is-size-5 m-4">
<i
class="icon icon-delete m-2 mx-4"
onclick="axiosDelete('problem', '{{problem_id}}')"
data-problem_id="{{problem_id}}"
></i>
</span>
{{/hbsPrint}}
helpersCode.hbsPrintHTML()
Kind: instance method of HelpersCode
Example
{{#hbsPrintHTML}} <i class="icon icon-highImp"> </i> {{/hbsPrintHTML}}
helpersCode.hbsPrintJS()
Kind: instance method of HelpersCode
Example
{#hbsPrintJS}} $(() => { let allKeywords = $(".hljs-keyword") }) {{/hbsPrintJS}}
HelpersDate
Kind: global class
new HelpersDate()
let helpersDate = new HelpersDate()
helpersDate.getDuration()
Kind: instance method of HelpersDate
Example
{{getDuration "00:20:00" "00:40:00" "minutes"}}
helpersDate.getReadableFormat()
Kind: instance method of HelpersDate
Example
{{getReadableFormat problem_created from/to}} // 15 hours ago
helpersDate.difference()
Kind: instance method of HelpersDate
Date: 2022-02-17
Example
{{getDifferenceInDays created "days"}}
helpersDate.format()
Kind: instance method of HelpersDate
Date: 2022-02-17
Example
{{format created "ll"}}
HelpersIfElse
Kind: global class
new HelpersIfElse()
let ifelse = new ifelse()
helpersIfElse.ifLength()
Kind: instance method of HelpersIfElse
Example
{{#ifLength arr}}
{{problem}}
{{else}}
render this
{{/ifLength}}
helpersIfElse.ifTaskArr()
Kind: instance method of HelpersIfElse
Example
{{#ifTaskArr arr}}
{{problem}}
{{else}}
render this
{{/ifTaskArr}}
helpersIfElse.ifCheatsheetArr()
Kind: instance method of HelpersIfElse
Example
{{#ifCheatsheetArr arr}}
{{problem}}
{{else}}
render this
{{/ifCheatsheetArr}}
helpersIfElse.ifProblemArr()
Kind: instance method of HelpersIfElse
Example
* {{#ifProblemArr arr}}
{{problem}}
{{else}}
render this
{{/ifProblemArr}}
helpersIfElse.ifTagSnippetArr()
Kind: instance method of HelpersIfElse
Example
* {{#ifTagSnippetArr arr}}
{{problem}}
{{else}}
render this
{{/ifTagSnippetArr}}
helpersIfElse.ifSecondArrayIsLonger()
Kind: instance method of HelpersIfElse
Example
{{#ifSecondArrayIsLonger problem task}}
array problem longer than task
{{else}}
not longer
{{/ifSecondArrayIsLonger}}
helpersIfElse.ifLengthGreaterThan()
Kind: instance method of HelpersIfElse
Example
{{#ifLengthGreaterThan task 3}}
length of task is greater than 3
{{else}}
not longer than one
{{/ifLengthGreaterThan}}
helpersIfElse.ifEmpty()
Kind: instance method of HelpersIfElse
Example
{{#ifEmpty problem}}
hello
{{else}}
fill in this form
{{/ifEmpty}}
ObjectsHelper
Kind: global class
new ObjectsHelper()
let array = new objecthelper()
objectsHelper.getTasksCompleted()
Kind: instance method of ObjectsHelper
Example
{{getTasksCompleted problem }}
objectsHelper.countByCondition()
Kind: instance method of ObjectsHelper
Example
{{countByCondition problem "status" "to do"}}
objectsHelper.countTaskPercentage()
Kind: instance method of ObjectsHelper
Example
{{#each data as |problem|}}
{{countTaskPercentage problem "status" "doing"}}
{{#each data.tasks as |task|}}
{{countByCondition data.tasks "status" "doing"}}
{{/each}}