0.2.0 • Published 7 years ago
eslint-plugin-strict-cast v0.2.0
strict-cast 
Strict type conversion for javascript. Inspired by reason string convertion functions
Usage
import { float_of_string } from "strict-cast";
float_of_string("10.5"); // 10.5API
let string_of_bool: boolean => string;Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly.
let bool_of_string: string => boolean;Convert the given string to a boolean. Raise Invalid_argument "bool_of_string" if the string is not "true" or "false".
let string_of_float: float => string;Return the string representation of a floating-point number.
let float_of_string: string => float;Convert the given string to a float. Raise Failure "float_of_string" if the given string is not a valid representation of a float.
eslint plugin
The plugin is used to forbid the usage of unsafe Number, Boolean and String type conversions.
yarn add eslint-plugin-strict-cast --devmodule.exports = {
plugins: ["strict-cast"],
rules: {
"strict-cast/strict-cast": "error"
}
};0.2.0
7 years ago