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

@esri/cedar

Package Overview
Dependencies
Maintainers
14
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esri/cedar - npm Package Compare versions

Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.4

9

CHANGELOG.md

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

## [1.0.0-alpha.4]
### Fixed
- allow overriding properties of graphs
### Changed
- bundling deepmerge instead of defining a deepMerge function
## [1.0.0-alpha.3]

@@ -163,3 +169,4 @@ ### Changed

[Unreleased]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.3...master
[Unreleased]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.4...master
[1.0.0-alpha.4]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.3...v1.0.0-alpha.4
[1.0.0-alpha.3]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.2...v1.0.0-alpha.3

@@ -166,0 +173,0 @@ [1.0.0-alpha.2]: https://github.com/Esri/cedar/compare/v1.0.0-alpha.1...v1.0.0-alpha.2

134

dist/umd/cedar.js
/**
* @esri/cedar - v1.0.0-alpha.3 - Thu Nov 30 2017 14:27:19 GMT-0800 (PST)
* @esri/cedar - v1.0.0-alpha.4 - Fri Dec 01 2017 10:11:00 GMT-0800 (PST)
* Copyright (c) 2017 Environmental Systems Research Institute, Inc.

@@ -12,47 +12,96 @@ * Apache-2.0

/**
* Merges n objects
* @param {object} source Empty object that other objects will be merged into
* @return {object} Merged objects
*/
function deepMerge(source) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var arrOfObjs = args.slice();
arrOfObjs.forEach(function (obj) {
entries(obj).forEach(function (p) {
if (Array.isArray(source)) {
source.push(_arrOrObj(p.value));
}
else {
source[p.key] = _arrOrObj(p.value);
}
});
});
return source;
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function _arrOrObj(val) {
return Array.isArray(val)
? deepMerge([], val)
: typeof val === 'object'
? deepMerge({}, val)
: val;
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]'
|| stringValue === '[object Date]'
|| isReactElement(value)
}
/**
* Iterates over an object and produces an array of key/val pairs
* @param {object} obj Object to iterate over
* @return {array} Array of key, val pairs.
*/
function entries(obj) {
var pairs = [];
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
pairs.push({ key: key, value: obj[key] });
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneIfNecessary(value, optionsArgument) {
var clone = optionsArgument && optionsArgument.clone === true;
return (clone && isMergeableObject(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
}
function defaultArrayMerge(target, source, optionsArgument) {
var destination = target.slice();
source.forEach(function(e, i) {
if (typeof destination[i] === 'undefined') {
destination[i] = cloneIfNecessary(e, optionsArgument);
} else if (isMergeableObject(e)) {
destination[i] = deepmerge(target[i], e, optionsArgument);
} else if (target.indexOf(e) === -1) {
destination.push(cloneIfNecessary(e, optionsArgument));
}
});
return destination
}
function mergeObject(target, source, optionsArgument) {
var destination = {};
if (isMergeableObject(target)) {
Object.keys(target).forEach(function(key) {
destination[key] = cloneIfNecessary(target[key], optionsArgument);
});
}
return pairs;
Object.keys(source).forEach(function(key) {
if (!isMergeableObject(source[key]) || !target[key]) {
destination[key] = cloneIfNecessary(source[key], optionsArgument);
} else {
destination[key] = deepmerge(target[key], source[key], optionsArgument);
}
});
return destination
}
function deepmerge(target, source, optionsArgument) {
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var options = optionsArgument || { arrayMerge: defaultArrayMerge };
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneIfNecessary(source, optionsArgument)
} else if (sourceIsArray) {
var arrayMerge = options.arrayMerge || defaultArrayMerge;
return arrayMerge(target, source, optionsArgument)
} else {
return mergeObject(target, source, optionsArgument)
}
}
deepmerge.all = function deepmergeAll(array, optionsArgument) {
if (!Array.isArray(array) || array.length < 2) {
throw new Error('first argument should be an array with at least two elements')
}
// we are sure there are at least 2 values, so it is safe to have no initial value
return array.reduce(function(prev, next) {
return deepmerge(prev, next, optionsArgument)
})
};
var deepmerge_1 = deepmerge;
var area = {

@@ -352,3 +401,5 @@ type: 'serial',

if (!!definition.overrides) {
spec = deepMerge({}, spec, definition.overrides);
// NOTE: this counts on using deepmerge < 2.x
// see: https://github.com/KyleAMathews/deepmerge#arraymerge
spec = deepmerge_1(spec, definition.overrides, { clone: true });
}

@@ -416,2 +467,3 @@ var chart = AmCharts.makeChart(elementId, spec);

// TODO: remove
var render = {

@@ -418,0 +470,0 @@ renderChart: renderChart,

{
"name": "@esri/cedar",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.4",
"description": "Visualization framework for the ArcGIS Platform",

@@ -25,2 +25,3 @@ "files": [

"pretest": "npm run lint",
"start": "npm run test:watch",
"test": "jest --coverage",

@@ -65,3 +66,3 @@ "test:watch": "npm run test -- --watch",

"amcharts3": "amcharts/amcharts3",
"@esri/cedar-amcharts": "^1.0.0-alpha.2",
"@esri/cedar-amcharts": "^1.0.0-alpha.4",
"@esri/arcgis-rest-request": "^1.0.0-alpha.2"

@@ -68,0 +69,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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