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

@rpldy/shared

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/shared - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

lib/cjs/utils/isProduction.js

8

lib/cjs/batchItem.js

@@ -10,3 +10,3 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -16,3 +16,3 @@ var BISYM = Symbol["for"]("__rpldy-bi__");

var getBatchItemWithUrl = function getBatchItemWithUrl(batchItem, url) {
var getBatchItemWithUrl = function (batchItem, url) {
batchItem.url = url;

@@ -22,3 +22,3 @@ return batchItem;

var getBatchItemWithFile = function getBatchItemWithFile(batchItem, file) {
var getBatchItemWithFile = function (batchItem, file) {
batchItem.file = file;

@@ -28,3 +28,3 @@ return batchItem;

var isLikeFile = function isLikeFile(f) {
var isLikeFile = function (f) {
return f && (f instanceof Blob || f instanceof File || _typeof(f) === "object" && f.name && f.type);

@@ -31,0 +31,0 @@ };

@@ -116,2 +116,8 @@ "use strict";

});
Object.defineProperty(exports, "isProduction", {
enumerable: true,
get: function get() {
return _utils.isProduction;
}
});
exports.logger = void 0;

@@ -118,0 +124,0 @@

@@ -12,2 +12,4 @@ "use strict";

var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -17,9 +19,9 @@

var isEnvDebug = function isEnvDebug() {
return process.env.NODE_ENV !== "production" && process.env.DEBUG;
var isEnvDebug = function () {
return !(0, _utils.isProduction)() && process.env.DEBUG;
};
var isDebugOn = function isDebugOn() {
var isDebugOn = function () {
if (typeof isDebug !== "boolean") {
isDebug = isEnvDebug() || _hasWindow["default"] && ("location" in window && !!~window.location.search.indexOf("rpldy_debug=true") || window[_consts.DEBUG_LOG_KEY] === true);
isDebug = isEnvDebug() || (0, _hasWindow["default"])() && ("location" in window && !!~window.location.search.indexOf("rpldy_debug=true") || window[_consts.DEBUG_LOG_KEY] === true);
}

@@ -32,4 +34,4 @@

var setDebug = function setDebug(debugOn) {
if (_hasWindow["default"]) {
var setDebug = function (debugOn) {
if ((0, _hasWindow["default"])()) {
window[_consts.DEBUG_LOG_KEY] = debugOn;

@@ -43,3 +45,3 @@ }

var debugLog = function debugLog() {
var debugLog = function () {
if (isDebugOn()) {

@@ -46,0 +48,0 @@ var _console;

@@ -8,3 +8,3 @@ "use strict";

var setHeaders = function setHeaders(req, headers) {
var setHeaders = function (req, headers) {
if (headers) {

@@ -11,0 +11,0 @@ Object.keys(headers).forEach(function (name) {

@@ -8,4 +8,4 @@ "use strict";

var _default = function _default(trigger, event) {
var doTrigger = function doTrigger(event) {
var triggerCancellable = function (trigger, event) {
var doTrigger = function (event) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

@@ -37,2 +37,3 @@ args[_key2 - 1] = arguments[_key2];

var _default = triggerCancellable;
exports["default"] = _default;

@@ -8,3 +8,3 @@ "use strict";

var isEmpty = function isEmpty(val) {
var isEmpty = function (val) {
return val === null || val === undefined;

@@ -14,3 +14,3 @@ };

var _default = function _default(trigger, event) {
var doTrigger = function doTrigger(event) {
var doTrigger = function (event) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

@@ -17,0 +17,0 @@ args[_key2 - 1] = arguments[_key2];

@@ -8,6 +8,11 @@ "use strict";

var _default = function _default(obj) {
return process.env.NODE_ENV === "production" ? obj : Object.freeze(obj);
var _isProduction = _interopRequireDefault(require("./isProduction"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var devFreeze = function (obj) {
return (0, _isProduction["default"])() ? obj : Object.freeze(obj);
};
var _default = devFreeze;
exports["default"] = _default;

@@ -8,6 +8,9 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var hasWindow = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && !!window.document;
var hasWindow = function () {
return (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && !!window.document;
};
var _default = hasWindow;
exports["default"] = _default;

@@ -62,2 +62,8 @@ "use strict";

});
Object.defineProperty(exports, "isProduction", {
enumerable: true,
get: function get() {
return _isProduction["default"];
}
});

@@ -80,2 +86,4 @@ var _isFunction = _interopRequireDefault(require("./isFunction"));

var _isProduction = _interopRequireDefault(require("./isProduction"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

@@ -82,0 +90,0 @@

@@ -8,3 +8,3 @@ "use strict";

var isFunction = function isFunction(f) {
var isFunction = function (f) {
return typeof f === "function";

@@ -11,0 +11,0 @@ };

@@ -8,3 +8,3 @@ "use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -11,0 +11,0 @@ var _default = function _default(obj) {

@@ -8,3 +8,3 @@ "use strict";

var getPropsExtractor = function getPropsExtractor(prop) {
var getPropsExtractor = function (prop) {
var props = [].concat(prop);

@@ -25,3 +25,3 @@ return function (arr) {

var _default = function _default(arr1, arr2, prop) {
var isSamePropInArrays = function (arr1, arr2, prop) {
var diff = true;

@@ -41,2 +41,3 @@ var propsExtractor = getPropsExtractor(prop);

var _default = isSamePropInArrays;
exports["default"] = _default;

@@ -12,3 +12,3 @@ "use strict";

var isMergeObj = function isMergeObj(obj) {
var isMergeObj = function (obj) {
return (0, _isPlainObject["default"])(obj) || Array.isArray(obj);

@@ -19,3 +19,3 @@ };

var getKeys = function getKeys(obj, options) {
var getKeys = function (obj, options) {
var keys = Object.keys(obj);

@@ -25,6 +25,6 @@ return options.withSymbols ? keys.concat(Object.getOwnPropertySymbols(obj)) : keys;

var getMerge = function getMerge() {
var getMerge = function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var merge = function merge(target) {
var merge = function (target) {
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

@@ -40,13 +40,15 @@ sources[_key - 1] = arguments[_key];

if (typeof prop !== "undefined" || options.undefinedOverwrites) {
//object/array - go deeper
if (isMergeObj(prop)) {
if (typeof target[key] === "undefined" || !(0, _isPlainObject["default"])(target[key])) {
//recreate target prop if doesnt exist or not an object
target[key] = Array.isArray(prop) ? [] : {};
if (!options.predicate || options.predicate(key, prop)) {
if (typeof prop !== "undefined" || options.undefinedOverwrites) {
//object/array - go deeper
if (isMergeObj(prop)) {
if (typeof target[key] === "undefined" || !(0, _isPlainObject["default"])(target[key])) {
//recreate target prop if doesnt exist or not an object
target[key] = Array.isArray(prop) ? [] : {};
}
merge(target[key], prop);
} else {
target[key] = prop;
}
merge(target[key], prop);
} else {
target[key] = prop;
}

@@ -53,0 +55,0 @@ }

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

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -7,3 +7,3 @@ import { FILE_STATES } from "./consts";

var getBatchItemWithUrl = function getBatchItemWithUrl(batchItem, url) {
var getBatchItemWithUrl = function (batchItem, url) {
batchItem.url = url;

@@ -13,3 +13,3 @@ return batchItem;

var getBatchItemWithFile = function getBatchItemWithFile(batchItem, file) {
var getBatchItemWithFile = function (batchItem, file) {
batchItem.file = file;

@@ -19,3 +19,3 @@ return batchItem;

var isLikeFile = function isLikeFile(f) {
var isLikeFile = function (f) {
return f && (f instanceof Blob || f instanceof File || _typeof(f) === "object" && f.name && f.type);

@@ -22,0 +22,0 @@ };

@@ -13,2 +13,2 @@ import invariant from "invariant";

export { //cant use * because of flow
isFunction, isPlainObject, isSamePropInArrays, devFreeze, merge, getMerge, clone, pick, hasWindow } from "./utils";
isFunction, isPlainObject, isSamePropInArrays, devFreeze, merge, getMerge, clone, pick, hasWindow, isProduction } from "./utils";
import { DEBUG_LOG_KEY } from "./consts";
import hasWindow from "./utils/hasWindow";
import { isProduction } from "./utils";
var isDebug;
var isEnvDebug = function isEnvDebug() {
return process.env.NODE_ENV !== "production" && process.env.DEBUG;
var isEnvDebug = function () {
return !isProduction() && process.env.DEBUG;
};
var isDebugOn = function isDebugOn() {
var isDebugOn = function () {
if (typeof isDebug !== "boolean") {
isDebug = isEnvDebug() || hasWindow && ("location" in window && !!~window.location.search.indexOf("rpldy_debug=true") || window[DEBUG_LOG_KEY] === true);
isDebug = isEnvDebug() || hasWindow() && ("location" in window && !!~window.location.search.indexOf("rpldy_debug=true") || window[DEBUG_LOG_KEY] === true);
}

@@ -17,4 +18,4 @@

var setDebug = function setDebug(debugOn) {
if (hasWindow) {
var setDebug = function (debugOn) {
if (hasWindow()) {
window[DEBUG_LOG_KEY] = debugOn;

@@ -26,3 +27,3 @@ }

var debugLog = function debugLog() {
var debugLog = function () {
if (isDebugOn()) {

@@ -29,0 +30,0 @@ var _console;

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

var setHeaders = function setHeaders(req, headers) {
var setHeaders = function (req, headers) {
if (headers) {

@@ -3,0 +3,0 @@ Object.keys(headers).forEach(function (name) {

@@ -1,3 +0,3 @@

export default (function (trigger, event) {
var doTrigger = function doTrigger(event) {
var triggerCancellable = function (trigger, event) {
var doTrigger = function (event) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

@@ -27,2 +27,4 @@ args[_key2 - 1] = arguments[_key2];

return event ? doTrigger.apply(void 0, [event].concat(args)) : doTrigger;
});
};
export default triggerCancellable;

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

var isEmpty = function isEmpty(val) {
var isEmpty = function (val) {
return val === null || val === undefined;

@@ -6,3 +6,3 @@ };

export default (function (trigger, event) {
var doTrigger = function doTrigger(event) {
var doTrigger = function (event) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

@@ -9,0 +9,0 @@ args[_key2 - 1] = arguments[_key2];

@@ -1,3 +0,7 @@

export default (function (obj) {
return process.env.NODE_ENV === "production" ? obj : Object.freeze(obj);
});
import isProduction from "./isProduction";
var devFreeze = function (obj) {
return isProduction() ? obj : Object.freeze(obj);
};
export default devFreeze;

@@ -1,4 +0,7 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var hasWindow = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && !!window.document;
var hasWindow = function () {
return (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && !!window.document;
};
export default hasWindow;

@@ -9,2 +9,3 @@ import isFunction from "./isFunction";

import hasWindow from "./hasWindow";
export { isFunction, isSamePropInArrays, devFreeze, merge, getMerge, clone, pick, isPlainObject, hasWindow };
import isProduction from "./isProduction";
export { isFunction, isSamePropInArrays, devFreeze, merge, getMerge, clone, pick, isPlainObject, hasWindow, isProduction };

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

var isFunction = function isFunction(f) {
var isFunction = function (f) {
return typeof f === "function";

@@ -3,0 +3,0 @@ };

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

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

@@ -3,0 +3,0 @@ export default (function (obj) {

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

var getPropsExtractor = function getPropsExtractor(prop) {
var getPropsExtractor = function (prop) {
var props = [].concat(prop);

@@ -17,3 +17,3 @@ return function (arr) {

export default (function (arr1, arr2, prop) {
var isSamePropInArrays = function (arr1, arr2, prop) {
var diff = true;

@@ -31,2 +31,4 @@ var propsExtractor = getPropsExtractor(prop);

return !diff;
});
};
export default isSamePropInArrays;
import isPlainObject from "./isPlainObject";
export var isMergeObj = function isMergeObj(obj) {
export var isMergeObj = function (obj) {
return isPlainObject(obj) || Array.isArray(obj);
};
var getKeys = function getKeys(obj, options) {
var getKeys = function (obj, options) {
var keys = Object.keys(obj);

@@ -11,6 +11,6 @@ return options.withSymbols ? keys.concat(Object.getOwnPropertySymbols(obj)) : keys;

var getMerge = function getMerge() {
var getMerge = function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var merge = function merge(target) {
var merge = function (target) {
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

@@ -26,13 +26,15 @@ sources[_key - 1] = arguments[_key];

if (typeof prop !== "undefined" || options.undefinedOverwrites) {
//object/array - go deeper
if (isMergeObj(prop)) {
if (typeof target[key] === "undefined" || !isPlainObject(target[key])) {
//recreate target prop if doesnt exist or not an object
target[key] = Array.isArray(prop) ? [] : {};
if (!options.predicate || options.predicate(key, prop)) {
if (typeof prop !== "undefined" || options.undefinedOverwrites) {
//object/array - go deeper
if (isMergeObj(prop)) {
if (typeof target[key] === "undefined" || !isPlainObject(target[key])) {
//recreate target prop if doesnt exist or not an object
target[key] = Array.isArray(prop) ? [] : {};
}
merge(target[key], prop);
} else {
target[key] = prop;
}
merge(target[key], prop);
} else {
target[key] = prop;
}

@@ -39,0 +41,0 @@ }

{
"version": "0.6.0",
"version": "0.7.0",
"name": "@rpldy/shared",

@@ -30,3 +30,3 @@ "description": "internal set of utils+types for react-uploady",

},
"gitHead": "43de735c426078647a9768caa733ba6cfd190d32"
"gitHead": "5bd0ebc140b45e44b168511f501b9f22628abd56"
}

@@ -15,2 +15,3 @@ export type Destination = {

autoUpload?: boolean;
clearPendingOnAdd?: boolean;
destination?: Destination;

@@ -97,1 +98,19 @@ inputFieldName?: string;

export const isPlainObject: (obj: unknown) => boolean;
export const isFunction: (val: unknown) => boolean;
export const isProduction: boolean;
export const hasWindow: boolean;
export const pick: <T>(obj: T, props: string[]) => T;
export type MergeFn = <T>(target: T, ...sources: T[]) => T;
export const merge: MergeFn;
export const clone: <T>(obj: T, mergeFn?: MergeFn) => T;
export const devFreeze: <T>(obj: T) => T;
export const isSamePropInArrays: (arr1: any[], arr2: any[], prop: string | string[]) => boolean;
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