has-required-props
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -87,4 +87,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
function hasRequiredProps(requiredProps, props) { | ||
if ((typeof props === 'undefined' ? 'undefined' : _typeof(props)) !== 'object' || isEmpty(props)) return false; | ||
if (typeof requiredProps !== 'string' && !Array.isArray(requiredProps) || typeof requiredProps === 'string' && requiredProps.trim() === '' || isEmpty(requiredProps)) return false; | ||
if ((typeof props === 'undefined' ? 'undefined' : _typeof(props)) !== 'object' || isEmpty(props) || typeof requiredProps !== 'string' && !Array.isArray(requiredProps) || typeof requiredProps === 'string' && requiredProps.trim() === '' || isEmpty(requiredProps)) return false; | ||
@@ -91,0 +90,0 @@ var check = _hasRequiredProps(requiredProps); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.hasRequiredProps=t():e.hasRequiredProps=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if("object"!==("undefined"==typeof t?"undefined":u(t))||c(t))return!1;if("string"!=typeof e&&!Array.isArray(e)||"string"==typeof e&&""===e.trim()||c(e))return!1;var r=s(e);return Array.isArray(t)?t.every(r):r(t)}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t["default"]=o;var f=r(1),i=n(f),c=function(e){return null==e||(Array.isArray(e)?0===e.length:0===Object.keys(e).length)},s=function(e){return function(t){return"string"==typeof e?void 0!==(0,i["default"])(t,e):e.every(function(e){return void 0!==(0,i["default"])(t,e)})}};e.exports=t["default"]},function(e,t){function r(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function n(e){return e?Array.isArray(e)?e.join("."):e:""}/*! | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.hasRequiredProps=t():e.hasRequiredProps=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if("object"!==("undefined"==typeof t?"undefined":u(t))||c(t)||"string"!=typeof e&&!Array.isArray(e)||"string"==typeof e&&""===e.trim()||c(e))return!1;var r=s(e);return Array.isArray(t)?t.every(r):r(t)}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t["default"]=o;var f=r(1),i=n(f),c=function(e){return null==e||(Array.isArray(e)?0===e.length:0===Object.keys(e).length)},s=function(e){return function(t){return"string"==typeof e?void 0!==(0,i["default"])(t,e):e.every(function(e){return void 0!==(0,i["default"])(t,e)})}};e.exports=t["default"]},function(e,t){function r(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function n(e){return e?Array.isArray(e)?e.join("."):e:""}/*! | ||
* get-value <https://github.com/jonschlinkert/get-value> | ||
@@ -3,0 +3,0 @@ * |
11
index.js
@@ -16,9 +16,8 @@ import get from 'get-value' | ||
export default function hasRequiredProps (requiredProps, props) { | ||
if (typeof props !== 'object' || isEmpty(props)) return false | ||
if (typeof requiredProps !== 'string' && | ||
!Array.isArray(requiredProps) || | ||
typeof requiredProps === 'string' && | ||
requiredProps.trim() === '' || | ||
if (typeof props !== 'object' || | ||
isEmpty(props) || | ||
typeof requiredProps !== 'string' && !Array.isArray(requiredProps) || | ||
typeof requiredProps === 'string' && requiredProps.trim() === '' || | ||
isEmpty(requiredProps) | ||
) return false | ||
) return false | ||
@@ -25,0 +24,0 @@ const check = _hasRequiredProps(requiredProps) |
@@ -31,4 +31,3 @@ 'use strict'; | ||
function hasRequiredProps(requiredProps, props) { | ||
if ((typeof props === 'undefined' ? 'undefined' : _typeof(props)) !== 'object' || isEmpty(props)) return false; | ||
if (typeof requiredProps !== 'string' && !Array.isArray(requiredProps) || typeof requiredProps === 'string' && requiredProps.trim() === '' || isEmpty(requiredProps)) return false; | ||
if ((typeof props === 'undefined' ? 'undefined' : _typeof(props)) !== 'object' || isEmpty(props) || typeof requiredProps !== 'string' && !Array.isArray(requiredProps) || typeof requiredProps === 'string' && requiredProps.trim() === '' || isEmpty(requiredProps)) return false; | ||
@@ -35,0 +34,0 @@ var check = _hasRequiredProps(requiredProps); |
{ | ||
"name": "has-required-props", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Assert that your object props have non-undefined values for each required prop", | ||
@@ -22,4 +22,6 @@ "main": "lib/index.js", | ||
"babel-preset-es2015": "^6.9.0", | ||
"coveralls": "^2.11.12", | ||
"cross-env": "^1.0.8", | ||
"ghooks": "^1.3.2", | ||
"nyc": "^7.1.0", | ||
"rimraf": "^2.5.3", | ||
@@ -33,2 +35,4 @@ "standard": "^7.1.2", | ||
"check": "standard && npm test", | ||
"coverage": "nyc npm test", | ||
"report-coverage": "cat coverage/lcov.info | coveralls", | ||
"build:commonjs": "babel index.js --out-dir lib", | ||
@@ -72,2 +76,13 @@ "build:umd": "cross-env NODE_ENV=development webpack --display-modules index.js dist/has-required-props.js", | ||
}, | ||
"nyc": { | ||
"reporter": [ | ||
"lcov", | ||
"text" | ||
], | ||
"lines": 100, | ||
"statements": 100, | ||
"functions": 100, | ||
"branches": 100, | ||
"check-coverage": true | ||
}, | ||
"config": { | ||
@@ -74,0 +89,0 @@ "ghooks": { |
@@ -6,2 +6,3 @@ # has-required-props | ||
[![Build Status](https://travis-ci.org/danne931/has-required-props.svg?branch=master)](https://travis-ci.org/danne931/has-required-props) | ||
[![Coverage Status](https://coveralls.io/repos/github/danne931/has-required-props/badge.svg)](https://coveralls.io/github/danne931/has-required-props) | ||
[![npm version](https://img.shields.io/npm/v/has-required-props.svg?style=flat-square)](https://www.npmjs.com/package/has-required-props) | ||
@@ -8,0 +9,0 @@ [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13286
71
14
175