Skip to content

Commit

Permalink
chore(gatsby-telemetry): Migrate is-truthy to TypeScript (#25884)
Browse files Browse the repository at this point in the history
  • Loading branch information
blainekasten committed Jul 20, 2020
1 parent 2e6825a commit 6f0d756
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
@@ -1,4 +1,4 @@
const isTruthy = require(`../is-truthy`)
import { isTruthy } from "../is-truthy"

describe(`isTruthy`, () => {
it(`handles Booleans`, () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-telemetry/src/event-storage.js
Expand Up @@ -5,7 +5,7 @@ const fetch = require(`node-fetch`)
const Configstore = require(`configstore`)
const { ensureDirSync } = require(`fs-extra`)

const isTruthy = require(`./is-truthy`)
import { isTruthy } from "./is-truthy"

/* The events data collection is a spooled process that
* buffers events to a local fs based buffer
Expand Down
@@ -1,6 +1,6 @@
// Returns true for `true`, true, positive numbers
// Returns false for `false`, false, 0, negative integers and anything else
const isTruthy = value => {
export function isTruthy(value: any): boolean {
// Return if Boolean
if (typeof value === `boolean`) return value

Expand All @@ -19,5 +19,3 @@ const isTruthy = value => {
// Default to false
return false
}

module.exports = isTruthy

0 comments on commit 6f0d756

Please sign in to comment.