Socket
Book a DemoInstallSign in
Socket

flow-runtime-faker

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flow-runtime-faker

object faker generation based on flow description

1.0.132
latest
Source
npmnpm
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

logo

Build Status codecov npm GitHub license Maintenance Donate

Motivation

Type definitions in javascript can help adding type safety for classes. But should not make more complicated property based testing. This package aims to generate random objects based on their flow definitions

Installation

yarn add flow-runtime-faker -D or npm install flow-runtime-faker --save-dev

if you use only flow and not flow-runtime. You can use this plugin by:

  • yarn add flow-runtime babel-plugin-flow-runtime -D or npm install flow-runtime babel-plugin-flow-runtime --save-dev
  • add the next configuration for tests phase on your .babelrc
   {
   ...
    "env": {
       "test": {
           "plugins": [["flow-runtime", { "assert": false, "annotate": false }]]
       }
     }
   }

Usage

import faker from 'flow-runtime-faker'

type otherType {
    fuz: 42 | 7 | 32 | "Some" | "Some Other" | false
}

type myType = {
    foo: number,
    bar: number[],
    daz: string,
    don: otherType
}

let value = fake(test)

console.log(value)
/*
type myType = {
    foo: 10,
    bar: [1,6.40],
    daz: "something",
    don: {
        fuz: 42
    }
}
*/

Support

Done?Flow Type
number
string
boolean
null
void
numeric literals
string literals
boolean literals
union
maybe
optional
arrays
subtypes
function

Keywords

faker

FAQs

Package last updated on 12 Jun 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.