teleren/devto huggingface dataset:
Tame your Firebase Realtime Database with MobX
Tags: mobx, firebase, javascript, react
Published: 2018-10-10 16:20:38

---
title: Tame your Firebase Realtime Database with MobX
published: true
description: How to map your Firebase Realtime Database to Mobx Observables
tags: mobx, firebase, javascript, react
cover_image: https://pbs.twimg.com/media/DpJ-k6HXcAcHWKz.png:large
---


While Firebase's Realtime Database enables you to build almost anything, manipulating realtime data in your app can lead to writing code that is hard to debug, understand and maintain.


Enter [MobX](https://mobx.js.org) and [mobx-firebase-database](https://github.com/rakannimer/mobx-firebase-database).

MobX is a powerful state management library that works with all front-end frameworks.

MobX-firebase-database allows you to map your Firebase realtime data to MobX observables (box, array or map) with `firebase`, `firebase-admin` or `react-native-firebase`


## Using it 

`mobx-firebase-database` exports one function getMobxFire, call it with firebase and your firebase config to get access to your toolbox.


```typescript
import getMobxFire from "mobx-firebase-database";
import firebase from "firebase/app";
import "firebase/database";

// Don't worry about calling it more than once.
const { toBox, toArray, toMap, getFirebaseRef, destroy } = getMobxFire({
  config,
  firebase
});

```

- `toBox` : Turns a firebase ref to an observable box

- `toArray` : Turns a firebase ref to an observable ordered array of `{key,value}` objects

- `toMap` : Turns a firebase ref (with any query you can think of) to an observable map: `Map<K,V>` where K is the child key name and V is the child value


Now that we have access to this set of primitives to build on. We can easily use them to build UIs.

## Using `mobx-firebase-database` with Vanilla JS

```typescript
import { observe } from "mobx";
import getMobxFirebase from "mobx-firebase-database";
import firebase from "firebase/app";
import "firebase/database";
import { config } from "../config";

const PATH = `TEST_SANDBOX/posts/1`;
let counter = 0;
const pretty = obj =>
  `<pre>${JSON.stringify(obj, null, 2)}</pre>`;

const { toBox } = getMobxFirebase({
  config,
  firebase
});
const refToPost = firebase.database().ref(PATH);
const { value } = toBox(refToPost);

setInterval(() => {
  counter += 1;
  // Write data fo firebase here
  refToPost.set({
    title: `post title ${counter}`
  });
}, 500);
observe(value, () => {
  // see it update here
  document.getElementById("root").innerHTML = pretty(
    value.get()
  );
});

```

## Using `mobx-firebase-database` with ReactJS


```typescript

const App = observer(() => {
  // Render it here
  return <pre>{JSON.stringify(value.get())}</pre>;
});

render(<App />, document.getElementById("root"));

```

It's that simple :)

Want to know more : 

[Experiment with VanillaJS code](https://codesandbox.io/s/jzon1ywl2y)
[Experiment with React code](https://codesandbox.io/s/jzon1ywl2y)
[Read the docs](https://github.com/rakannimer/mobx-firebase-database#api)

That's it folks !

Have any questions ? 
Message me on [@rakannimer](https://twitter.com/rakannimer) or leave a comment here !
.Net Core – Drop Down (Select) Won’t Populate
Tags: core, razor, csharp
Published: 2018-10-17 02:14:00

---
title: .Net Core – Drop Down (Select) Won’t Populate
published: true
tags: core,razor,csharp
canonical_url: 
---

I had a recent bug that took me much too long to solve and the root of the cause was me. I got a bit too delete happy and deleted a crucial file that allows me to use Razor Tag Helpers to bring a List into a View as a Drop Down (Select).

# The Error

Here’s how the error presented itself:

- SelectList won’t populate
- Select or DropDown is empty
- value = Microsoft.AspNetCore.Mvc.Rendering.SelectList
- value = System.Linq.OrderedEnumerable2 [Microsoft.AspNetCore.Mvc.Rendering.SelectListItem,System.String]

# My Code

This is how I usually bring a list into my view and the code does work once the solution is implemented.

### Controller:

```csharp
    ViewBag.ProductLines = productLineRepository.GetAll().Select(r => new SelectListItem {
         Text = r.Name, 
         Value = r.Id.ToString() 
    }).OrderBy(x => x.Text).ToList();
```

### View:

```html
    <select name="ProductLine" id="ProductLine" asp-for="ProductLine" asp-items="@ViewBag.ProductLines">
    <option value="0">Select One...</option>
    </select>
```

# The Solution

The solution is a bit embarrasing: I deleted the \_ViewImports.cshtml view which included an import that enables tag helpers. The list was not rendering because tag helpers was not enabled.

To solve this:

- create a file named “\_ViewImports.cshtml” directly under your Views folder
- add the following into it:

```html
@using MyNameSpace @addTagHelper \*, Microsoft.AspNetCore.Mvc.TagHelpers
```

- save file and refresh.

Pretty simple fix!
Raven.Studio.zip Index.html not available
Tags: aspnet, net
Published: 2018-10-19 09:58:33

---
title: Raven.Studio.zip Index.html not available
published: true
tags: ASP.NET,.NET
canonical_url: https://blogit.create.pt/ricardocosta/2018/10/10/raven-studio-zip-index-html-not-available/
---

I had RavenDb embedded in a aspnet.core web api and I was getting this error when I tried to reach Raven Studio: The following file was not available: index.html. Please make sure that the Raven.Studio.zip file exist in the main directory (near the Raven.Server.exe).

The solution was to copy Raven.Studio.zip to the root directory of the web api.

![Raven Studio Zip](https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/10/Raven-Studio-Zip.png?resize=300%2C73&ssl=1)

 

The post [Raven.Studio.zip Index.html not available](https://blogit.create.pt/ricardocosta/2018/10/10/raven-studio-zip-index-html-not-available/) appeared first on [Blog IT](https://blogit.create.pt).
Design choice
Tags: discuss
Published: 2018-10-10 13:28:38

---
title: Design choice
published: true
description: Given two different design approaches, which one is better over the other?
tags: #devdiscuss
---

What are the advantages and disadvantages when using either one of the following:
payer.transfer(payee, amount);   vs.  transfer(payer, payee, amount);

Regarding this simple example, my interest is toward the design, dependencies, abstraction etc... 



Appreciate your comments and resources pointed out!
Most Popular Development Posts Of The Week (10 October 2018)
Tags: go, webdev, react, javascript
Published: 2018-10-11 12:01:01

---
title: Most Popular Development Posts Of The Week (10 October 2018)
published: true
tags: golang,webdev,react,javascript
canonical_url: https://medium.com/daily-now/most-popular-development-posts-of-the-week-10-october-2018-6da35333fed5
cover_image: https://cdn-images-1.medium.com/max/1024/1*VIycXvNHKO1XetyzJ0OOrQ.jpeg
---

<figcaption>So often people are working hard at the wrong thing. Working on the right thing is probably more important than working hard.</figcaption>

Let’s get ready to rumble!
We have just launched [Daily Go on Product Hunt](https://www.producthunt.com/posts/daily-go/), help us spread the word :)





- [Top 10 VS Code Extensions for Frontend Developers in 2018](https://app.dailynow.co/r/6703e44b32b555f98ea989c7fa5c4713) by [Nwose Lotanna](https://medium.com/u/cb0ab32a7733)
- [DOES CSS4 EXIST?](https://app.dailynow.co/r/74318f95a25e70947d28e8d7543a349f)
- [CSS Cube Login Form](https://app.dailynow.co/r/58b22e2fffaf5b6418579d8c5793c9ac)
- [Moving from NodeJS to Go](https://app.dailynow.co/r/46952c176a42a6245ee9da90d0c88a22)
- [What truly makes a senior developer](https://app.dailynow.co/r/7af9ded5c1cf0dd9db93c68d905aea13) by [Brenn](https://medium.com/u/b29abf345025)
- [How to decide on the best technology for your website](https://app.dailynow.co/r/85a4eb827fc5696e2365d8ed548cb8ec) by [Ondřej Polesný](https://medium.com/u/e1c7669e0ebc)
- [Web Developer](https://app.dailynow.co/r/3327128a6f286e2e1a122b03e2e5b0c6)
- [Introducing Frontend Mentor — Supercharge your front-end skills by building real projects](https://app.dailynow.co/r/c78d1d3a836205a3305805930db7d96c)
- [9 React Styled-Components UI Libraries for 2018](https://app.dailynow.co/r/bfa77a4a246e165a19639abaa3bddfae) by [Jonathan Saring](https://medium.com/u/c9a6ef212193)
- [On Node Framework Popularity](https://app.dailynow.co/r/c97ac63a4b06c7ea2701f76834bac5a4) by [Eran Hammer](https://medium.com/u/b4e3921706ee)


[_Thanks to Daily_](https://www.dailynow.co/) _developers can focus on code instead of searching for news. Get immediate access to all these posts and much more just by opening a new tab._

![](https://cdn-images-1.medium.com/max/1024/1*m8Uf-6F4Q5AOp_wW6tbKSQ.jpeg)

* * *
Handling repetitive mistakes
Tags: career, discuss
Published: 2018-10-10 12:19:19

---
title: Handling repetitive mistakes
published: true
description: One is fine, but one after another?
tags: career, discuss
---

You make a mistake. Shit happens, nobody is perfect. Maybe your boss or client tells you that it is okay, just be careful next time.

Next time is right on the corner, and behold, you make another mistake... Things are told to you a little less nicely. You are doing your best, but you just keep making stupid mistakes. Mistakes you know you shouldn't be doing, but with the pressure, the stress, the rush... everything you do seems to be a major struggle.

I'm currently in this situation. I just can't seem to do anything right. I feel like I'm doing my best, but I just can't stop myself from fucking things up. People are losing money, or their patience, or their heads. I'm being quite pragmatic about it, as periods like that most likely happen to everyone.

Have you ever been in such a situation? Where you just have one of those days or weeks of being a terrible programmer? How do you deal with it?
Wordpressを無料でS3、SendGrid、Heroku、Composerでデプロイする
Tags: s3, heroku, composer, wordpress
Published: 2018-10-10 10:33:00

---
title: Wordpressを無料でS3、SendGrid、Heroku、Composerでデプロイする
published: true
description: 
tags: S3, Heroku, Composer,Wordpress
---

![composer](https://thepracticaldev.s3.amazonaws.com/i/vo9389jfent1sf6pxnp8.png)

https://github.com/PhilippHeuer/wordpress-heroku

こちらのGithubにある「Deploy to heroku」ボタンをクリックすることでも構築できるのですが、画像やプラグインを永続的に維持するためにはローカルに構築してcomposer updateしてから差分をgit pushし、同じソースコードをherokuにデプロイする必要があるのでした。

いろいろいじってやってみたところ、なんとかできたので、この後もいろいろ試したいと思う。

一番苦労した点は、英語版Wordpressを日本語化する方法だった。

ローカルでWP CLIを使って日本語化ファイルをダウンロードし、git pushしたらできた。

`wp core language install ja --activate`



参考URL
https://upd.world/wordpress-cloud9/
https://qiita.com/miya0001/items/96a684e2f819f9d8b4a4
https://qiita.com/fuwamaki/items/8684003bb47197336645
Introduction to Rx (Swift & Kotlin) - Part 1
Tags: rx, swift, kotlin, frp
Published: 2018-10-10 10:14:02

---
title: Introduction to Rx (Swift & Kotlin) - Part 1
published: True
description: Introduction to Rx
tags: Rx, Swift, Kotlin, FRP
---
![Rx](https://thepracticaldev.s3.amazonaws.com/i/5hibxe9q08p5avmnq8z3.png)

I've started a series of blog posts in which I guide you step by step on how to use Rx properly. I will be providing instructions for both Kotlin and Swift users. Enjoy!

https://blog.testfairy.com/rx-for-the-ultimate-beginner-part-1-swift/
https://blog.testfairy.com/rx-for-the-ultimate-beginner-part-1-kotlin/
Explain like I'm five: Python Profilers
Tags: python, profilers, likeimfive
Published: 2018-10-10 10:02:30

---
title: Explain like I'm five: Python Profilers
published: true
description: What are Python profilers? Explain it to me like I'm five years old.
tags: python, profilers, likeimfive
---

I kinda get the idea of what profilers are but can you explain it to me so I fully understand what they do?
Concerns testing with anonymous controller
Tags: rails, ruby, testing, rspec
Published: 2018-10-10 08:41:48

---
title: Concerns testing with anonymous controller
published: true
description: Rails controller concerns in isolated anonymous controller
tags: #rails #ruby #testing #rspec
---


Once you have a controller concern like this:

```ruby
module BillingErrorRescuer
  extend ActiveSupport::Concern

  included do
    rescue_from Billing::LimitExceeded, with: :rescue_billing_limits

    def rescue_billing_limits
      render status: 402, json: Billing::PlanPresenter.new(@account).to_json
    end
  end
end
```

The idea is to test is separately in anonymous controller:

```ruby
require 'spec_helper'

describe BillingErrorRescuer, type: :controller do
  controller do
    include BillingErrorRescuer

    def action
      @account = FactoryBot.create :account
      raise Billing::LimitExceeded
    end
  end

  before do
    routes.draw { get :action, to: "anonymous#action" }
    get :action
  end

  let(:account) { create :account, state: :trial }

  it 'renders json with billing data' do
    expect(response.body).to match_json_schema('controllers/billing_error_rescuer')
  end
end
```

What does this test do?
1. Enables testing controller features in rspec
2. Defines anonymous controller to include concern extension
3. Draw the route for the action
4. Calls the action with the default controller pipeline

Thats it!
Thanks `rspec-rails` gem, that we have almost everything out of the box!
Total Guide To Dynamic Angular Animations That Can Be Customized At Runtime
Tags: angular, javascript, webdev, css
Published: 2018-10-10 08:01:04

---
title: Total Guide To Dynamic Angular Animations That Can Be Customized At Runtime
published: true
description: From route transitions to small details like feedback when clicking on a button or displaying a tooltip, animations give your project that nice sleek look. Well crafted animations communicate that…
tags: angular,javascript,webdev,css
cover_image: https://thepracticaldev.s3.amazonaws.com/i/tpreouqhwmb4cbq3ar4f.jpg
canonical_url: https://medium.com/tomastrajan/total-guide-to-dynamic-angular-animations-that-can-be-toggled-at-runtime-be5bb6778a0a
---


> #Animations make projects look much better

From route transitions to small details like feedback when clicking on a button or displaying a tooltip, animations give your project that nice sleek look. Well crafted animations communicate that you or your organization care enough to put effort into details and create best possible experience for your users.

Angular makes it very convenient to create both simple and complex animations using its built-in DSL (domain specific language). More so, Angular Material component library is rife with many great looking animations…

Let’s have a look on the following route transition animation recorded from [Angular NgRx Material Starter](https://github.com/tomastrajan/angular-ngrx-material-starter) project to get an idea.

![Animation preview](https://thepracticaldev.s3.amazonaws.com/i/je5at7ms24x525tlsjua.gif)

[Read more...](https://medium.com/tomastrajan/total-guide-to-dynamic-angular-animations-that-can-be-toggled-at-runtime-be5bb6778a0a)
Email Sending in Django 2, Part -1 
Tags: django, emails, consoleemailbackend
Published: 2018-10-10 07:02:04

---
title:  Email Sending in Django 2, Part -1 
published: true
description: a small video on how do we send emails in django
tags: django, emails, console email backend
cover_image: https://thepracticaldev.s3.amazonaws.com/i/myviiw0hfodakqlojsom.png 
---

Yay ... I made another django video,

Emails are an integral part of any web application. You need them for user verification, billing or any kind of communication with users. 

In this video, we are taking a look into django's console email backend, We will be sending emails as usual, but instead of actual email, Django will display it in the terminal. Let me know what you guys think in comments here or in youtube, I am happy to help you resolve any issues you encounter.

{% youtube sCQebCRL7AU %} 

Source code : https://github.com/ShobiExplains/SimpleDjangoAuthentication/releases/tag/v0.0.2
#help Insert json data into 3 tables and respond 2 table's data through json using knexjs, expressjs
Tags: node, knexjs, express
Published: 2018-10-10 06:56:29

---
title: #help Insert json data into 3 tables and respond 2 table's data through json using knexjs, expressjs
published: true
description: 
tags: #nodejs #knexjs #expressjs
---
Elixir: 新たなMySQLドライバMyXQLの開発を開始
Tags: elixir, webdev, news
Published: 2018-10-10 03:21:32

---
title: Elixir: 新たなMySQLドライバMyXQLの開発を開始
published: true
description: Plataformatec社はElixir Forumで、新たなMySQLドライバ「MyXQL」を開発中だと発表しました。Ectoと統合して、デフォルトのMySQLドライバとすることを目指すそうです。
tags: #elixir, #webdev, #news
---

Plataformatec社はElixir Forumで、[新たなMySQLドライバ「MyXQL」を開発中だ](https://elixirforum.com/t/announcing-a-new-mysql-driver-myxql/17124)と発表しました。[Ecto](https://github.com/elixir-ecto/ecto)と統合して、デフォルトのMySQLドライバとすることを目指すそうです。

現在、MySQLとやりとりするためのおもなドライバは[Mariaex](https://github.com/xerions/mariaex)です。Mariaexとの連携は2014年12月から始まりました。コミュニティにとって、きわめて重要なソフトウェアです。Mariaexにより、MySQLデータベースに依存する多くの会社が、EctoやPhoenixなどのライブラリをとおしてElixirをプロダクションに利用できました。

# MariaexとElixirのこれまで
Mariaexが世に出てから、つぎのようなできごとがありました。

- MySQLのv5.7やv8.0といった新しいバージョンには、新たな認証モードやプロトコル変更、あるいは新しいデータ型などが加えられました。Mariaexのプロジェクトは、これらバージョンによって異なるすべての機能に対応しなければなりません。
- Mariaexの開発が始まったのは、Elixir v1.0の直後です。その経緯から、`Kernel.SpecialForms`の[`with`](https://hexdocs.pm/elixir/Kernel.SpecialForms.html#with/1)など最近のElixirの機能を必ずしも活かせていません。Elixir v1.3は新たな[`calendar`](https://hexdocs.pm/elixir/Calendar.html#t:calendar/0)型を採り入れました。これは、Mariaexが備える`date`/`type`型と競合します。
- Mariaexの開始時、Ectoはv0.3.0でした。その後、Ecto v1.0がリリースされ、さらにEcto v2.0が出ています。Ecto v1.0の頃は、Ectoが接続プールやトランザクションなど多くの扱いを担っていました。しかし、Ecto v2.0では、DBConnectionという共通プロジェクをとおして、ドライバに重心を移しています。この新しいアプローチにより、Ectoの外側で、ドライバをより効率的に活用できるようになるのです(「James Fish「[DBConnection - Ecto's SQL Sandbox](http://www.elixirconf.eu/elixirconf2017/james-fish)」参照)。メリットの一方で、この移行により既存のドライバのコードに手が加わえられることになります。

これらの要因その他があいまって、Mariaexリポジトリが複雑になり、メンテナンスも難しくなってきました(未解決のイシューが40、プルリクエストは9)。Mariaexのコードベースをどう改善するか検討した末、新たにMyXQLを開発するという結論に至ったとのことです。これまでのしがらみらをなくし、一から始めることが最善のアプローチだという理由です。


# MyXQLが目指すもの
MyXQLの開発は[Wojtek Mach](http://blog.plataformatec.com.br/2018/08/welcome-wojtek-mach-to-plataformatec/)氏が主導します。MyXQLが目指すものはつぎのとおりです。

- MyXQLはElixir v1.4とMySQL v5.7.9以上を必要とします。最近のMySQLに加えられた多くの機能やデータ型をサポートし、それと同じElixirの機能にも対応できるでしょう。
    - [Elixir v1.4.0](https://github.com/elixir-lang/elixir/releases/tag/v1.4.0)は2017年1月のリリースです。
    - MySQL v5.7.9は、2015年10月にリリースされた5.7ブランチから最初に一般リリースされました。
- PostgrexやMariaexドライバの開発経験から得た知識を活用します。MyXQLにはPostgrexの組織とコード構成を反映し、Mariaexから得た経験を活かします。この計画には、両プロジェクトのパーツが必要に応じて再利用されるでしょう。


# MyXQLの開発
MyXQLはEcto v3.0のリリースには間に合わないことにご注意ください。今のところ、開発には引き続きMariaexを使わなければなりません。すでに、MariaexをEcto 3.0に対応させるプルリクエストも行われました。MyXQLがリリースされたときは、開発にMariaexとどちらでも選べるようになります。大多数のユーザーはMyXQLに円滑に移行できるでしょう。それでも、ふたつのツールが選べる期間は確保されます。最終的に、MariaexのサポートはEctoから除かれます（より正確には`Ecto.SQL`から削除）。

現在コードは開発中です。MySQLに大きく依存している開発者は、[MySQLリポジトリ](http://github.com/elixir-ecto/myxql)をご覧いただければ、進行状況がわかり、議論にも参加できます。
DevOps RoadMap
Tags: devops, productivity, discuss
Published: 2018-10-10 02:16:10

I read few articles this evening and I stumbled upon a nice github repo that has roadmaps for FrontEnd Dev, BackEnd Dev and DevOps.

I would say it is quite spot on as I can relate to image shown below. If you go to like /r/Devops on Reddit , few times a week you will see people questioning how to become a DevOps. 

A DevOps person to me is someone that is extraordinary generalist. Has background in many IT fields such as Networking, Sys Admin, Dev, Software Engineer and basically understands application lifecycle from end to end. 

I seen many DevOps positions but to me they are more of a Dev or Sys positions rather than "DevOps", but who am I to say what is a DevOps Engineer when there is so much that goes into that position. 

Anyway, the point of this article was for me to share you that great Github Repo by [kamranahmedse](https://github.com/kamranahmedse/developer-roadmap), take a look at it and comment below your thoughts on if it really takes that much to become a "DevOps" Engineer.
![altext](https://github.com/kamranahmedse/developer-roadmap/raw/master/images/devops.png)

I've been in IT field for almost two decades starting as a
Help Desk, Tier1/2/3 Support (unix/linux), Network Engineer, Software Engineer, Systems Specialist(Dev), Systems Engineer and for past 5-6y a DevOps Engineer. 

For me to hire a DevOps Engineer, I would be ok if he/she knew 
How to code (Pick fav language)
How to manage AWS/GCE/Azure (pick one)
How to troubleshoot network
How to build pipeline for any CI/CD 
Get along(support) with Devs/Ops/Noc/Qa etc..
Innovate and not being afraid of trying new things as well as make life easier for him/her self and others.
And if you take all that above into consideration, that person is someone that saves productivity time and money for xyz company.
Transitioning from Java to Python Professionally
Tags: discuss, help, python, java
Published: 2018-10-10 01:20:51

---
title: Transitioning from Java to Python Professionally
published: true
description: 
tags: discuss, help, python, java
---


I'm planning to making the transition from coding professionally in Java to Python. I've only worked on side projects with python (which I really enjoy) but don't have any professional experience in the language. I will be going on interviews as early as this week, any advice on how to make prepare?
Converting 'Yes'/'No' value to true/false in assertions
Tags: coding, testing
Published: 2018-10-10 01:11:55

---
title: Converting 'Yes'/'No' value to true/false in assertions
published: true
description: How do you validate the 'human-readable' text of a website matches the computer-friendly database value?
tags: Coding, Testing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/n9c8ly5vrlxdipbq8z7k.jpg
---

I recently wrote a test which required comparing a "Yes/No" displayed value to a true/false database value.

![](https://thepracticaldev.s3.amazonaws.com/i/tansx2adnfozdhausxj4.png)
<figcaption>Example HTML table mapping to the Database Schema.</figcaption>

It wasn't a completely trivial task, so I decided to share the solution I came up with.

This example uses [Chai's 'expect' assertion syntax](https://www.chaijs.com/api/bdd/).

Here's my initial attempt at it, **which is incomplete for reasons I'll go into next.**

```js
const displayedValue = browser.getText('.is-allowed'); // returns 'Yes'

// pretend 'db' is some magic database call that's all wired up
const databaseValue = db.getValue('isAllowed'); // returns true

expect(displayedValue === 'Yes').to.equal(databaseValue, 'Displayed value matches database')
```

This is pretty good, but won't catch issues in the display value if the `databaseValue` is `false`.

For example, if our `isAllowed` database value is `false`, then anything other than 'Yes' in that displayed value will result in a passing test (e.g. an invalid value that's misspelled, like 'Yess', would still pass).

Instead, here's a more resilient variation, where we validate that the text is either 'Active' or 'Inactive' depending on the database value:

```js
const displayedValue = browser.getText('.status'); // returns 'Inactive'

const databaseValue = db.getValue('isActive'); // returns false

expect(displayedValue).to.equal(isActive ? 'Active' : 'Inactive');
```

This version helps lock down the possible allowed values being displayed. It only passes if the exact text matches for either database value.

Notice we also don't need to add an assertion message, as the values we're passing in are all the information we need.

If you're unfamiliar with the ternary statement at the end, check out [this insightful post](https://scotch.io/tutorials/understand-the-javascript-ternary-operator-like-abc#toc-ternary-operator).

Header Photo by [Jon Tyson](https://unsplash.com/photos/qAZO-wu3tik?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/search/photos/yes?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)