Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commodo-fields-float

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commodo-fields-float

A int field for Commodo composable models.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
decreased by-7.14%
Maintainers
1
Weekly downloads
 
Created
Source

commodo-fields-float

Build Status Covergrowth Status code style: prettier All Contributors PRs Welcome

A simple float field, used with the Commodo withFields higher order function.

Install

npm install --save commodo-fields-float

Or if you prefer yarn:

yarn add commodo-fields-float

Quick Example:

import { compose } from "ramda";
import { withFields, string } from "@commodo/fields";
import { float } from "commodo-fields-float";

const Company = compose(
  withFields({
    name: string(),
    growth: float(), // Use it to store a single float value.
    pastGrowths: float({ list: true }) // Or use it to store a list of float values.
    // Other fields you might need...
  }),
  // Other higher order functions (HOFs) you might need...
)();

const company = new Company();
company.name = "Acme Corporation";

// The float field can only accepts floats. 
company.growth = 5.65;
company.pastGrowths = [5.63, 3.99, 9.542, 10];

// The following will throw the WithFieldsError error.
company.growth =  "5.65";
company.pastGrowths = [5.63, 3.99, "9.542", 10];

Note: alternatively, you could've also used the populate method to assign the data:

const company = new Company();
company.populate = { growth: 5.65, pastGrowths: [5.63, 3.99, 9.542, 10] };

Contributors

Thanks goes to these wonderful people (emoji key):


Adrian Smijulj

💻 📖 💡 👀 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 18 Apr 2020

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

  • 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