Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ember-truth-helpers
Advanced tools
HTMLBars template helpers for additional truth logic in if
and unless
statements.
ember install ember-truth-helpers
Helper | JavaScript | HTMLBars | Variable argument count allowed |
---|---|---|---|
eq | if (a === b) | {{if (eq a b)}} | No |
not-eq | if (a !== b) | {{if (not-eq a b)}} | No |
not | if (!a) | {{if (not a)}} | Yes |
and | if (a && b) | {{if (and a b)}} | Yes |
or | if (a || b) | {{if (or a b)}} | Yes |
xor | if (a !== b) | {{if (xor a b)}} | No |
gt | if (a > b) | {{if (gt a b)}} | No |
gte | if (a >= b) | {{if (gte a b)}} | No |
lt | if (a < b) | {{if (lt a b)}} | No |
lte | if (a <= b) | {{if (lte a b)}} | No |
is-array | if (Ember.isArray(a)) | {{if (is-array a)}} | Yes |
is-empty | if (Ember.isEmpty(a)) | {{if (is-empty a)}} | No |
is-equal | if (Ember.isEqual(a, b)) | {{if (is-equal a b)}} | No |
is-equal
uses Ember.isEqual
helper to evaluate equality of two values.
eq
should be sufficient for most applications. is-equal
is necessary when trying to compare a complex object to
a primitive value.
ember-truth-helpers
is a glint enabled addon. Add this to your
types/global.d.ts
file:
import '@glint/environment-ember-loose';
import type EmberTruthRegistry from 'ember-truth-helpers/template-registry';
declare module '@glint/environment-ember-loose/registry' {
export default interface Registry extends EmberTruthRegistry, /* other addon registries */ {
// local entries
}
}
For the entire guide, please refer to Using Addons section on the glint handbook.
Types are made available through package.json exports
field. In order for TS
to recognize this (beginning from TS 4.7), you must set
moduleResolution
to node16
or nodenext
.
For usage in gts
or gjs
files, all helpers are exported from the index:
import { or } from 'ember-truth-helpers';
<template>
{{#if (or @admin @user)}}
Admin Controls are going here
{{/if}}
</template>
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Ember Truth Helpers
The npm package ember-truth-helpers receives a total of 111,783 weekly downloads. As such, ember-truth-helpers popularity was classified as popular.
We found that ember-truth-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.