New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

util-array-object-or-both

Package Overview
Dependencies
Maintainers
1
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

util-array-object-or-both - npm Package Compare versions

Comparing version 4.0.12 to 4.1.0

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

# 4.1.0 (2022-04-10)
### Features
- export defaults and version ([1107244](https://github.com/codsen/codsen/commit/1107244b45eff96ac1fc4ab992031ede0d10ba8c))
## 4.0.0 (2021-09-09)

@@ -8,0 +14,0 @@

4

dist/util-array-object-or-both.esm.js
/**
* @name util-array-object-or-both
* @fileoverview Validate and normalise user choice: array, object or both?
* @version 4.0.12
* @version 4.1.0
* @author Roy Revelt, Codsen Ltd

@@ -10,2 +10,2 @@ * @license MIT

import r from"lodash.includes";function m(a,t){let o=["object","objects","obj","ob","o"],s=["array","arrays","arr","aray","arr","a"],i=["any","all","everything","both","either","each","whatever","whatevs","e"],e={...{msg:"",optsVarName:"given variable"},...t};if(e?.msg&&e.msg.length>0&&(e.msg=`${e.msg.trim()} `),e.optsVarName!=="given variable"&&(e.optsVarName=`variable "${e.optsVarName}"`),r(o,a.toLowerCase().trim()))return"object";if(r(s,a.toLowerCase().trim()))return"array";if(r(i,a.toLowerCase().trim()))return"any";throw new TypeError(`${e.msg}The ${e.optsVarName} was customised to an unrecognised value: ${a}. Please check it against the API documentation.`)}export{m as arrObjOrBoth};
import r from"lodash.includes";var s="4.1.0";var y=s,l={msg:"",optsVarName:"given variable"};function m(t,o){let a=["object","objects","obj","ob","o"],n=["array","arrays","arr","aray","arr","a"],i=["any","all","everything","both","either","each","whatever","whatevs","e"],e={...l,...o};if(e?.msg&&e.msg.length>0&&(e.msg=`${e.msg.trim()} `),e.optsVarName!=="given variable"&&(e.optsVarName=`variable "${e.optsVarName}"`),r(a,t.toLowerCase().trim()))return"object";if(r(n,t.toLowerCase().trim()))return"array";if(r(i,t.toLowerCase().trim()))return"any";throw new TypeError(`${e.msg}The ${e.optsVarName} was customised to an unrecognised value: ${t}. Please check it against the API documentation.`)}export{m as arrObjOrBoth,l as defaults,y as version};
/**
* @name util-array-object-or-both
* @fileoverview Validate and normalise user choice: array, object or both?
* @version 4.0.12
* @version 4.1.0
* @author Roy Revelt, Codsen Ltd

@@ -10,2 +10,2 @@ * @license MIT

var utilArrayObjectOrBoth=(()=>{var E=Object.create;var a=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,F=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var A=(r,t,n)=>t in r?a(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,g=(r,t)=>{for(var n in t||(t={}))O.call(t,n)&&A(r,n,t[n]);if(m)for(var n of m(t))P.call(t,n)&&A(r,n,t[n]);return r};var j=r=>a(r,"__esModule",{value:!0});var x=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),l=(r,t)=>{for(var n in t)a(r,n,{get:t[n],enumerable:!0})},N=(r,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of S(t))!O.call(r,i)&&(n||i!=="default")&&a(r,i,{get:()=>t[i],enumerable:!(e=L(t,i))||e.enumerable});return r},M=(r,t)=>N(j(a(r!=null?E(F(r)):{},"default",!t&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),B=(r=>(t,n)=>r&&r.get(t)||(n=N(j({}),t,1),r&&r.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var $=x((dr,V)=>{var w=1/0,T=9007199254740991,C=17976931348623157e292,d=0/0,k="[object Arguments]",G="[object Function]",K="[object GeneratorFunction]",_="[object String]",X="[object Symbol]",H=/^\s+|\s+$/g,R=/^[-+]0x[0-9a-f]+$/i,U=/^0b[01]+$/i,Y=/^0o[0-7]+$/i,q=/^(?:0|[1-9]\d*)$/,z=parseInt;function D(r,t){for(var n=-1,e=r?r.length:0,i=Array(e);++n<e;)i[n]=t(r[n],n,r);return i}function J(r,t,n,e){for(var i=r.length,s=n+(e?1:-1);e?s--:++s<i;)if(t(r[s],s,r))return s;return-1}function Q(r,t,n){if(t!==t)return J(r,W,n);for(var e=n-1,i=r.length;++e<i;)if(r[e]===t)return e;return-1}function W(r){return r!==r}function Z(r,t){for(var n=-1,e=Array(r);++n<r;)e[n]=t(n);return e}function v(r,t){return D(t,function(n){return r[n]})}function rr(r,t){return function(n){return r(t(n))}}var f=Object.prototype,p=f.hasOwnProperty,c=f.toString,tr=f.propertyIsEnumerable,nr=rr(Object.keys,Object),er=Math.max;function ir(r,t){var n=I(r)||cr(r)?Z(r.length,String):[],e=n.length,i=!!e;for(var s in r)(t||p.call(r,s))&&!(i&&(s=="length"||or(s,e)))&&n.push(s);return n}function sr(r){if(!ar(r))return nr(r);var t=[];for(var n in Object(r))p.call(r,n)&&n!="constructor"&&t.push(n);return t}function or(r,t){return t=t==null?T:t,!!t&&(typeof r=="number"||q.test(r))&&r>-1&&r%1==0&&r<t}function ar(r){var t=r&&r.constructor,n=typeof t=="function"&&t.prototype||f;return r===n}function fr(r,t,n,e){r=y(r)?r:jr(r),n=n&&!e?mr(n):0;var i=r.length;return n<0&&(n=er(i+n,0)),yr(r)?n<=i&&r.indexOf(t,n)>-1:!!i&&Q(r,t,n)>-1}function cr(r){return ur(r)&&p.call(r,"callee")&&(!tr.call(r,"callee")||c.call(r)==k)}var I=Array.isArray;function y(r){return r!=null&&pr(r.length)&&!gr(r)}function ur(r){return h(r)&&y(r)}function gr(r){var t=b(r)?c.call(r):"";return t==G||t==K}function pr(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=T}function b(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function h(r){return!!r&&typeof r=="object"}function yr(r){return typeof r=="string"||!I(r)&&h(r)&&c.call(r)==_}function br(r){return typeof r=="symbol"||h(r)&&c.call(r)==X}function hr(r){if(!r)return r===0?r:0;if(r=Or(r),r===w||r===-w){var t=r<0?-1:1;return t*C}return r===r?r:0}function mr(r){var t=hr(r),n=t%1;return t===t?n?t-n:t:0}function Or(r){if(typeof r=="number")return r;if(br(r))return d;if(b(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=b(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(H,"");var n=U.test(r);return n||Y.test(r)?z(r.slice(2),n?2:8):R.test(r)?d:+r}function Ar(r){return y(r)?ir(r):sr(r)}function jr(r){return r?v(r,Ar(r)):[]}V.exports=fr});var wr={};l(wr,{arrObjOrBoth:()=>Nr});var u=M($(),1);function Nr(r,t){let n=["object","objects","obj","ob","o"],e=["array","arrays","arr","aray","arr","a"],i=["any","all","everything","both","either","each","whatever","whatevs","e"],o=g(g({},{msg:"",optsVarName:"given variable"}),t);if((o==null?void 0:o.msg)&&o.msg.length>0&&(o.msg=`${o.msg.trim()} `),o.optsVarName!=="given variable"&&(o.optsVarName=`variable "${o.optsVarName}"`),(0,u.default)(n,r.toLowerCase().trim()))return"object";if((0,u.default)(e,r.toLowerCase().trim()))return"array";if((0,u.default)(i,r.toLowerCase().trim()))return"any";throw new TypeError(`${o.msg}The ${o.optsVarName} was customised to an unrecognised value: ${r}. Please check it against the API documentation.`)}return B(wr);})();
var utilArrayObjectOrBoth=(()=>{var V=Object.create;var o=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames,g=Object.getOwnPropertySymbols,L=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var l=(r,t,e)=>t in r?o(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,p=(r,t)=>{for(var e in t||(t={}))h.call(t,e)&&l(r,e,t[e]);if(g)for(var e of g(t))S.call(t,e)&&l(r,e,t[e]);return r};var k=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),F=(r,t)=>{for(var e in t)o(r,e,{get:t[e],enumerable:!0})},m=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $(t))!h.call(r,s)&&s!==e&&o(r,s,{get:()=>t[s],enumerable:!(n=E(t,s))||n.enumerable});return r};var M=(r,t,e)=>(e=r!=null?V(L(r)):{},m(t||!r||!r.__esModule?o(e,"default",{value:r,enumerable:!0}):e,r)),P=r=>m(o({},"__esModule",{value:!0}),r);var N=k((Tr,x)=>{var j=1/0,w=9007199254740991,B=17976931348623157e292,O=0/0,C="[object Arguments]",R="[object Function]",D="[object GeneratorFunction]",G="[object String]",K="[object Symbol]",_=/^\s+|\s+$/g,X=/^[-+]0x[0-9a-f]+$/i,H=/^0b[01]+$/i,U=/^0o[0-7]+$/i,Y=/^(?:0|[1-9]\d*)$/,q=parseInt;function v(r,t){for(var e=-1,n=r?r.length:0,s=Array(n);++e<n;)s[e]=t(r[e],e,r);return s}function z(r,t,e,n){for(var s=r.length,i=e+(n?1:-1);n?i--:++i<s;)if(t(r[i],i,r))return i;return-1}function J(r,t,e){if(t!==t)return z(r,Q,e);for(var n=e-1,s=r.length;++n<s;)if(r[n]===t)return n;return-1}function Q(r){return r!==r}function W(r,t){for(var e=-1,n=Array(r);++e<r;)n[e]=t(e);return n}function Z(r,t){return v(t,function(e){return r[e]})}function rr(r,t){return function(e){return r(t(e))}}var a=Object.prototype,f=a.hasOwnProperty,c=a.toString,tr=a.propertyIsEnumerable,er=rr(Object.keys,Object),nr=Math.max;function ir(r,t){var e=A(r)||ur(r)?W(r.length,String):[],n=e.length,s=!!n;for(var i in r)(t||f.call(r,i))&&!(s&&(i=="length"||or(i,n)))&&e.push(i);return e}function sr(r){if(!ar(r))return er(r);var t=[];for(var e in Object(r))f.call(r,e)&&e!="constructor"&&t.push(e);return t}function or(r,t){return t=t==null?w:t,!!t&&(typeof r=="number"||Y.test(r))&&r>-1&&r%1==0&&r<t}function ar(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||a;return r===e}function cr(r,t,e,n){r=b(r)?r:jr(r),e=e&&!n?lr(e):0;var s=r.length;return e<0&&(e=nr(s+e,0)),br(r)?e<=s&&r.indexOf(t,e)>-1:!!s&&J(r,t,e)>-1}function ur(r){return pr(r)&&f.call(r,"callee")&&(!tr.call(r,"callee")||c.call(r)==C)}var A=Array.isArray;function b(r){return r!=null&&fr(r.length)&&!yr(r)}function pr(r){return d(r)&&b(r)}function yr(r){var t=y(r)?c.call(r):"";return t==R||t==D}function fr(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=w}function y(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function d(r){return!!r&&typeof r=="object"}function br(r){return typeof r=="string"||!A(r)&&d(r)&&c.call(r)==G}function dr(r){return typeof r=="symbol"||d(r)&&c.call(r)==K}function gr(r){if(!r)return r===0?r:0;if(r=hr(r),r===j||r===-j){var t=r<0?-1:1;return t*B}return r===r?r:0}function lr(r){var t=gr(r),e=t%1;return t===t?e?t-e:t:0}function hr(r){if(typeof r=="number")return r;if(dr(r))return O;if(y(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=y(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(_,"");var e=H.test(r);return e||U.test(r)?q(r.slice(2),e?2:8):X.test(r)?O:+r}function mr(r){return b(r)?ir(r):sr(r)}function jr(r){return r?Z(r,mr(r)):[]}x.exports=cr});var xr={};F(xr,{arrObjOrBoth:()=>Ar,defaults:()=>I,version:()=>wr});var u=M(N(),1);var T="4.1.0";var wr=T,I={msg:"",optsVarName:"given variable"};function Ar(r,t){let e=["object","objects","obj","ob","o"],n=["array","arrays","arr","aray","arr","a"],s=["any","all","everything","both","either","each","whatever","whatevs","e"],i=p(p({},I),t);if((i==null?void 0:i.msg)&&i.msg.length>0&&(i.msg=`${i.msg.trim()} `),i.optsVarName!=="given variable"&&(i.optsVarName=`variable "${i.optsVarName}"`),(0,u.default)(e,r.toLowerCase().trim()))return"object";if((0,u.default)(n,r.toLowerCase().trim()))return"array";if((0,u.default)(s,r.toLowerCase().trim()))return"any";throw new TypeError(`${i.msg}The ${i.optsVarName} was customised to an unrecognised value: ${r}. Please check it against the API documentation.`)}return P(xr);})();
{
"name": "util-array-object-or-both",
"version": "4.0.12",
"version": "4.1.0",
"description": "Validate and normalise user choice: array, object or both?",

@@ -5,0 +5,0 @@ "keywords": [

@@ -29,3 +29,3 @@ # util-array-object-or-both

The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `3.1.0`.
This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:

@@ -36,2 +36,4 @@ ```bash

If you need a legacy version which works with `require`, use version 3.1.0
## Quick Take

@@ -38,0 +40,0 @@

@@ -0,1 +1,2 @@

declare const version: string;
interface Opts {

@@ -5,2 +6,3 @@ msg?: string;

}
declare const defaults: Opts;
declare function arrObjOrBoth(

@@ -11,2 +13,2 @@ str: string,

export { arrObjOrBoth };
export { arrObjOrBoth, defaults, version };
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