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

onno-react

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onno-react - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

10

cjs/index.js

@@ -15,2 +15,3 @@ "use strict"

const IGNORE = /\s|\d+\.\d+/
const NUMBER = /^-?(\d*\.)?\d+$/
const push = Array.prototype.push

@@ -23,9 +24,11 @@ const isArray = Array.isArray

const isPlainObject = (x) => !!x && isObject(x) && !isArray(x)
const isNumber = isType("number")
const isString = isType("string")
const isUnitless = (x) => isNumber(x) && !!x
const isTypeNumber = isType("number")
const isNumber = (x) => isTypeNumber(x) && !isNaN(x)
const isNumberLike = (x) => isNumber(x) || (isString(x) && NUMBER.test(x))
const isUnitless = (x) => isNumberLike(x) && !!+x
const isFraction = (x) => isUnitless(x) && x > -1 && x < 1
const when = (p) => (f) => (x) => (p(x) ? f(x) : x)
const addPc = when(isFraction)((x) => x * 100 + "%")
const addPx = when(isUnitless)((x) => x + "px")
const addPc = when(isFraction)((x) => x * 100 + "%")
const addRem = when(isUnitless)((x) => x + "rem")

@@ -1013,2 +1016,3 @@ const addPcOrPx = (x) => addPx(addPc(x))

exports.isNumber = isNumber
exports.isNumberLike = isNumberLike
exports.isObject = isObject

@@ -1015,0 +1019,0 @@ exports.isPlainObject = isPlainObject

@@ -11,2 +11,3 @@ import { oneOfType, number, string, objectOf, arrayOf } from "prop-types"

const IGNORE = /\s|\d+\.\d+/
const NUMBER = /^-?(\d*\.)?\d+$/
const push = Array.prototype.push

@@ -19,9 +20,11 @@ const isArray = Array.isArray

const isPlainObject = (x) => !!x && isObject(x) && !isArray(x)
const isNumber = isType("number")
const isString = isType("string")
const isUnitless = (x) => isNumber(x) && !!x
const isTypeNumber = isType("number")
const isNumber = (x) => isTypeNumber(x) && !isNaN(x)
const isNumberLike = (x) => isNumber(x) || (isString(x) && NUMBER.test(x))
const isUnitless = (x) => isNumberLike(x) && !!+x
const isFraction = (x) => isUnitless(x) && x > -1 && x < 1
const when = (p) => (f) => (x) => (p(x) ? f(x) : x)
const addPc = when(isFraction)((x) => x * 100 + "%")
const addPx = when(isUnitless)((x) => x + "px")
const addPc = when(isFraction)((x) => x * 100 + "%")
const addRem = when(isUnitless)((x) => x + "rem")

@@ -1007,2 +1010,3 @@ const addPcOrPx = (x) => addPx(addPc(x))

isNumber,
isNumberLike,
isObject,

@@ -1009,0 +1013,0 @@ isPlainObject,

{
"name": "onno-react",
"license": "MIT",
"version": "0.4.3",
"version": "0.4.4",
"homepage": "https://onnojs.com",

@@ -30,6 +30,6 @@ "description": "Onno propTypes for React",

"@types/prop-types": "15.7.1",
"onno": "0.4.3",
"onno": "0.4.4",
"prop-types": "15.7.2"
},
"gitHead": "93e5c21887be219e17e88e2cf255b713c03acfd3"
"gitHead": "4addb96e57bac9689264f2018a7c88577011212b"
}
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