New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-truth-helpers

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-truth-helpers - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

24

addon/utils/register-helper.js
import Ember from 'ember';
function registerHelperIteration1(name, helperFunction) {
//earlier versions of ember with htmlbars used this
Ember.HTMLBars.helpers[name] = Ember.HTMLBars.makeBoundHelper(helperFunction);
}
function registerHelperIteration2(name, helperFunction) {
//registerHelper has been made private as _registerHelper
//this is kept here if anyone is using it
Ember.HTMLBars.registerHelper(name, Ember.HTMLBars.makeBoundHelper(helperFunction));
}
function registerHelperIteration3(name, helperFunction) {
//latest versin of ember uses this
Ember.HTMLBars._registerHelper(name, Ember.HTMLBars.makeBoundHelper(helperFunction));
}
export function registerHelper(name, helperFunction) {
if (Ember.HTMLBars._registerHelper) {
Ember.HTMLBars.helpers[name] = Ember.HTMLBars.makeBoundHelper(helperFunction);
if (Ember.HTMLBars.helpers) {
registerHelperIteration1(name, helperFunction);
} else {
registerHelperIteration3(name, helperFunction);
}
} else if (Ember.HTMLBars.registerHelper) {
Ember.HTMLBars.registerHelper(name, Ember.HTMLBars.makeBoundHelper(helperFunction));
registerHelperIteration2(name, helperFunction);
}
}

4

package.json
{
"name": "ember-truth-helpers",
"version": "0.0.2",
"description": "Ember HTMLBars Helpers for {{#if}} & {{#unless}}: not, and, or, eq & is-array",
"version": "0.0.3",
"description": "Ember HTMLBars Helpers for {{if}} & {{unless}}: not, and, or, eq & is-array",
"directories": {

@@ -6,0 +6,0 @@ "doc": "doc",

@@ -6,39 +6,45 @@ # Ember Truth Helpers for HTMLBars

**`eq`**
```hbs
{{#if (eq 1 2)}} 1 == 2 {{/if}}
{{#unless (eq 1 2)}} 1 != 2 {{/unless}}
```
{{#if (eq 1 2)}} 1 == 2 {{/if}}
{{#unless (eq 1 2)}} 1 != 2 {{/unless}}
**`not`**
```hbs
{{#if (not hasCrayons)}} I don't have crayons {{/if}}
{{#if (not hasCrayons hasPaper)}} I don't have crayons or paper {{/if}}
```
{{#if (not hasCrayons)}} I don't have crayons {{/if}}
{{#if (not hasCrayons hasPaper)}} I don't have crayons or paper {{/if}}
**`and`**
```hbs
{{#if (and hasCrayons hasPaper)}} I have crayons and paper {{/if}}
```
{{#if (and hasCrayons hasPaper)}} I have crayons and paper {{/if}}
**`or`**
```hbs
{{#if (or hasCrayons hasPaper)}} I have something {{/if}}
```
{{#if (or hasCrayons hasPaper)}} I have something {{/if}}
**`is-array`**
```hbs
{{#if (is-array siblings)}}
{{#each siblings as |sibling|}}
My sibling: {{sibling}}
{{/each}}
{{/if}}
```
{{#if (is-array siblings)}}
{{#each siblings as |sibling|}}
My sibling: {{sibling}}
{{/each}}
{{/if}}
**`in combination`**
```hbs
{{#if (and (not model.isLoading) model.isError)}}
There was an error loading the model
{{/if}}
```
{{#if (and (not model.isLoading) model.isError)}}
There was an error loading the model
{{/if}}
**`stand alone`**
```hbs
{{and itsCold myJumper}}
<!--returns `myJumper` if `itsCold` is truthy, otherwise returns `itsCold`-->
```
{{and itsCold myJumper}}
(returns myJumper if itsCold is truthy, otherwise returns itsCold ('false'))
## Install

@@ -45,0 +51,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc