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

d3plus-common

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-common - npm Package Compare versions

Comparing version 0.6.31 to 0.6.32

es/src/parseSides.js

29

build/d3plus-common.js
/*
d3plus-common v0.6.31
d3plus-common v0.6.32
Common functions and methods used across D3plus modules.
Copyright (c) 2017 D3plus - https://d3plus.org
Copyright (c) 2018 D3plus - https://d3plus.org
@license MIT

@@ -487,2 +487,26 @@ */

/**
@function parseSides
@desc Converts a string of directional CSS shorthand values into an object with the values expanded.
@param {String} sides The CSS shorthand string to expand.
*/
function parseSides(sides) {
var values = sides.split(/\s+/);
if (values.length === 1) { values = [values[0], values[0], values[0], values[0]]; }
else if (values.length === 2) { values = values.concat(values); }
else if (values.length === 3) { values.push(values[1]); }
return [
"top",
"right",
"bottom",
"left"
].reduce(function (acc, direction, i) {
var value = parseFloat(values[i]);
acc[direction] = value || 0;
return acc;
}, {});
}
/**
@function prefix

@@ -521,2 +545,3 @@ @desc Returns the appropriate CSS vendor prefix, given the current browser.

exports.merge = objectMerge;
exports.parseSides = parseSides;
exports.prefix = prefix;

@@ -523,0 +548,0 @@ exports.RESET = RESET;

6

build/d3plus-common.min.js
/*
d3plus-common v0.6.31
d3plus-common v0.6.32
Common functions and methods used across D3plus modules.
Copyright (c) 2017 D3plus - https://d3plus.org
Copyright (c) 2018 D3plus - https://d3plus.org
@license MIT
*/
if(typeof Object.assign!=="function"){Object.defineProperty(Object,"assign",{value:function e(n){"use strict";if(n===null){throw new TypeError("Cannot convert undefined or null to object")}var r=Object(n);for(var t=1;t<arguments.length;t++){var i=arguments[t];if(i!==null){for(var o in i){if(Object.prototype.hasOwnProperty.call(i,o)){r[o]=i[o]}}}}return r},writable:true,configurable:true})}if(!Array.prototype.includes){Object.defineProperty(Array.prototype,"includes",{value:function e(n,r){var t=Object(this);var i=t.length>>>0;if(i===0)return false;var o=r|0;var f=Math.max(o>=0?o:i-Math.abs(o),0);function a(e,n){return e===n||typeof e==="number"&&typeof n==="number"&&isNaN(e)&&isNaN(n)}while(f<i){if(a(t[f],n)){return true}f++}return false}})}(function(e,n){typeof exports==="object"&&typeof module!=="undefined"?n(exports,require("d3-selection"),require("d3-transition"),require("d3-array"),require("d3-collection")):typeof define==="function"&&define.amd?define("d3plus-common",["exports","d3-selection","d3-transition","d3-array","d3-collection"],n):n(e.d3plus={},e.d3Selection,e.d3Transition,e.d3Array,e.d3Collection)})(this,function(e,n,r,t,i){"use strict";function o(e,n){if(n===void 0){return function(n){return n[e]}}return function(r){return r[e]===void 0?n:r[e]}}function f(e){return e&&typeof e==="object"&&!Array.isArray(e)&&e!==void 0?true:false}function a(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];var r=e[0];var t=function(n){var t=e[n];Object.keys(t).forEach(function(e){var n=t[e];if(f(n)){if(r.hasOwnProperty(e)&&f(r[e])){r[e]=a({},r[e],n)}else{r[e]=n}}else if(Array.isArray(n)){if(r.hasOwnProperty(e)&&Array.isArray(r[e])){var i=r[e];n.forEach(function(e,n){if(n<i.length){var r=i[n];if(Object.is(r,e)){return}if(f(r)&&f(e)||Array.isArray(r)&&Array.isArray(e)){i[n]=a({},r,e)}else{i[n]=e}}else{i.push(e)}})}else{r[e]=n}}else{r[e]=n}})};for(var i=1;i<e.length;i++)t(i);return r}function s(e,n){if(n===void 0)n={};for(var r in n){if({}.hasOwnProperty.call(n,r)){e.attr(r,n[r])}}}function u(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}function c(){return""+u()+u()+"-"+u()+"-"+u()+"-"+u()+"-"+u()+u()+u()}var l="D3PLUS-COMMON-RESET";function d(e,n){if(f(e)){for(var r in e){if({}.hasOwnProperty.call(e,r)&&!r.startsWith("_")){var t=n&&f(n)?n[r]:undefined;if(e[r]===l){e[r]=t}else if(f(e[r])){d(e[r],t)}}}}}var y=function e(){this._on={};this._uuid=c()};y.prototype.config=function e(n){var r=this;if(!this._configDefault){var e={};for(var t in r.__proto__){if(t.indexOf("_")!==0&&!["config","constructor","render"].includes(t)){var i=r[t]();e[t]=f(i)?a({},i):i}}this._configDefault=e}if(arguments.length){for(var o in n){if({}.hasOwnProperty.call(n,o)&&o in r){var s=n[o];if(s===l){if(o==="on"){r._on=r._configDefault[o]}else{r[o](r._configDefault[o])}}else{d(s,r._configDefault[o]);r[o](s)}}}return this}else{var u={};for(var c in r.__proto__){if(c.indexOf("_")!==0&&!["config","constructor","render"].includes(c)){u[c]=r[c]()}}return u}};y.prototype.on=function e(n,r){return arguments.length===2?(this._on[n]=r,this):arguments.length?typeof n==="string"?this._on[n]:(this._on=Object.assign({},this._on,n),this):this._on};function v(e,n){if(n===void 0)n=[];if(!n||!(n instanceof Array)||!n.length){return undefined}return n.reduce(function(n,r){return Math.abs(r-e)<Math.abs(n-e)?r:n})}function h(e,n,r){if(e===void 0)e=this._shapeConfig;if(n===void 0)n="shape";if(r===void 0)r=false;var t={duration:this._duration,on:{}};var i=function(e){return function(n,r,t){while(n.__d3plus__){r=n.i;n=n.data||n.feature}return e(n,r,t)}};var o=function(e,r){for(var t in r){if({}.hasOwnProperty.call(r,t)&&!t.includes(".")||t.includes("."+n)){e.on[t]=i(r[t])}}};var f=function(e,n){for(var r in n){if({}.hasOwnProperty.call(n,r)){if(r==="on"){o(e,n[r])}else if(typeof n[r]==="function"){e[r]=i(n[r])}else if(typeof n[r]==="object"&&!(n instanceof Array)){e[r]={on:{}};f(e[r],n[r])}else{e[r]=n[r]}}}};f(t,e);if(this._on){o(t,this._on)}if(r&&e[r]){f(t,e[r]);if(e[r].on){o(t,e[r].on)}}return t}function p(e){return function n(){return e}}function g(e,t){t=Object.assign({},{condition:true,enter:{},exit:{},parent:n.select("body"),transition:r.transition().duration(0),update:{}},t);var i=/\.([^#]+)/g.exec(e),o=/#([^\.]+)/g.exec(e),f=/^([^.^#]+)/g.exec(e)[1];var a=t.parent.selectAll(e.includes(":")?e.split(":")[1]:e).data(t.condition?[null]:[]);var u=a.enter().append(f).call(s,t.enter);if(o){u.attr("id",o[1])}if(i){u.attr("class",i[1])}a.exit().transition(t.transition).call(s,t.exit).remove();var c=u.merge(a);c.transition(t.transition).call(s,t.update);return c}function m(e,n){if(n===void 0)n={};var r=new Set(t.merge(e.map(function(e){return i.keys(e)}))),o={};r.forEach(function(r){var i=e.map(function(e){return e[r]});var f;if(n[r]){f=n[r](i)}else{var a=i.map(function(e){return e||e===false?e.constructor:e}).filter(function(e){return e!==void 0});if(!a.length){f=undefined}else if(a.indexOf(Array)>=0){f=t.merge(i.map(function(e){return e instanceof Array?e:[e]}));f=Array.from(new Set(f));if(f.length===1){f=f[0]}}else if(a.indexOf(String)>=0){f=Array.from(new Set(i));if(f.length===1){f=f[0]}}else if(a.indexOf(Number)>=0){f=t.sum(i)}else if(a.indexOf(Object)>=0){f=m(i.filter(function(e){return e}))}else{f=Array.from(new Set(i.filter(function(e){return e!==void 0})));if(f.length===1){f=f[0]}}}o[r]=f});return o}function b(){if("-webkit-transform"in document.body.style){return"-webkit-"}else if("-moz-transform"in document.body.style){return"-moz-"}else if("-ms-transform"in document.body.style){return"-ms-"}else if("-o-transform"in document.body.style){return"-o-"}else{return""}}function _(e,n){if(n===void 0)n={};for(var r in n){if({}.hasOwnProperty.call(n,r)){e.style(r,n[r])}}}e.accessor=o;e.assign=a;e.attrize=s;e.BaseClass=y;e.closest=v;e.configPrep=h;e.constant=p;e.elem=g;e.isObject=f;e.merge=m;e.prefix=b;e.RESET=l;e.stylize=_;e.uuid=c;Object.defineProperty(e,"__esModule",{value:true})});
if(typeof Object.assign!=="function"){Object.defineProperty(Object,"assign",{value:function e(n){"use strict";if(n===null){throw new TypeError("Cannot convert undefined or null to object")}var r=Object(n);for(var t=1;t<arguments.length;t++){var i=arguments[t];if(i!==null){for(var o in i){if(Object.prototype.hasOwnProperty.call(i,o)){r[o]=i[o]}}}}return r},writable:true,configurable:true})}if(!Array.prototype.includes){Object.defineProperty(Array.prototype,"includes",{value:function e(n,r){var t=Object(this);var i=t.length>>>0;if(i===0)return false;var o=r|0;var f=Math.max(o>=0?o:i-Math.abs(o),0);function a(e,n){return e===n||typeof e==="number"&&typeof n==="number"&&isNaN(e)&&isNaN(n)}while(f<i){if(a(t[f],n)){return true}f++}return false}})}(function(e,n){typeof exports==="object"&&typeof module!=="undefined"?n(exports,require("d3-selection"),require("d3-transition"),require("d3-array"),require("d3-collection")):typeof define==="function"&&define.amd?define("d3plus-common",["exports","d3-selection","d3-transition","d3-array","d3-collection"],n):n(e.d3plus={},e.d3Selection,e.d3Transition,e.d3Array,e.d3Collection)})(this,function(e,n,r,t,i){"use strict";function o(e,n){if(n===void 0){return function(n){return n[e]}}return function(r){return r[e]===void 0?n:r[e]}}function f(e){return e&&typeof e==="object"&&!Array.isArray(e)&&e!==void 0?true:false}function a(){var e=[],n=arguments.length;while(n--)e[n]=arguments[n];var r=e[0];var t=function(n){var t=e[n];Object.keys(t).forEach(function(e){var n=t[e];if(f(n)){if(r.hasOwnProperty(e)&&f(r[e])){r[e]=a({},r[e],n)}else{r[e]=n}}else if(Array.isArray(n)){if(r.hasOwnProperty(e)&&Array.isArray(r[e])){var i=r[e];n.forEach(function(e,n){if(n<i.length){var r=i[n];if(Object.is(r,e)){return}if(f(r)&&f(e)||Array.isArray(r)&&Array.isArray(e)){i[n]=a({},r,e)}else{i[n]=e}}else{i.push(e)}})}else{r[e]=n}}else{r[e]=n}})};for(var i=1;i<e.length;i++)t(i);return r}function s(e,n){if(n===void 0)n={};for(var r in n){if({}.hasOwnProperty.call(n,r)){e.attr(r,n[r])}}}function u(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}function c(){return""+u()+u()+"-"+u()+"-"+u()+"-"+u()+"-"+u()+u()+u()}var l="D3PLUS-COMMON-RESET";function d(e,n){if(f(e)){for(var r in e){if({}.hasOwnProperty.call(e,r)&&!r.startsWith("_")){var t=n&&f(n)?n[r]:undefined;if(e[r]===l){e[r]=t}else if(f(e[r])){d(e[r],t)}}}}}var h=function e(){this._on={};this._uuid=c()};h.prototype.config=function e(n){var r=this;if(!this._configDefault){var e={};for(var t in r.__proto__){if(t.indexOf("_")!==0&&!["config","constructor","render"].includes(t)){var i=r[t]();e[t]=f(i)?a({},i):i}}this._configDefault=e}if(arguments.length){for(var o in n){if({}.hasOwnProperty.call(n,o)&&o in r){var s=n[o];if(s===l){if(o==="on"){r._on=r._configDefault[o]}else{r[o](r._configDefault[o])}}else{d(s,r._configDefault[o]);r[o](s)}}}return this}else{var u={};for(var c in r.__proto__){if(c.indexOf("_")!==0&&!["config","constructor","render"].includes(c)){u[c]=r[c]()}}return u}};h.prototype.on=function e(n,r){return arguments.length===2?(this._on[n]=r,this):arguments.length?typeof n==="string"?this._on[n]:(this._on=Object.assign({},this._on,n),this):this._on};function v(e,n){if(n===void 0)n=[];if(!n||!(n instanceof Array)||!n.length){return undefined}return n.reduce(function(n,r){return Math.abs(r-e)<Math.abs(n-e)?r:n})}function y(e,n,r){if(e===void 0)e=this._shapeConfig;if(n===void 0)n="shape";if(r===void 0)r=false;var t={duration:this._duration,on:{}};var i=function(e){return function(n,r,t){while(n.__d3plus__){r=n.i;n=n.data||n.feature}return e(n,r,t)}};var o=function(e,r){for(var t in r){if({}.hasOwnProperty.call(r,t)&&!t.includes(".")||t.includes("."+n)){e.on[t]=i(r[t])}}};var f=function(e,n){for(var r in n){if({}.hasOwnProperty.call(n,r)){if(r==="on"){o(e,n[r])}else if(typeof n[r]==="function"){e[r]=i(n[r])}else if(typeof n[r]==="object"&&!(n instanceof Array)){e[r]={on:{}};f(e[r],n[r])}else{e[r]=n[r]}}}};f(t,e);if(this._on){o(t,this._on)}if(r&&e[r]){f(t,e[r]);if(e[r].on){o(t,e[r].on)}}return t}function p(e){return function n(){return e}}function g(e,t){t=Object.assign({},{condition:true,enter:{},exit:{},parent:n.select("body"),transition:r.transition().duration(0),update:{}},t);var i=/\.([^#]+)/g.exec(e),o=/#([^\.]+)/g.exec(e),f=/^([^.^#]+)/g.exec(e)[1];var a=t.parent.selectAll(e.includes(":")?e.split(":")[1]:e).data(t.condition?[null]:[]);var u=a.enter().append(f).call(s,t.enter);if(o){u.attr("id",o[1])}if(i){u.attr("class",i[1])}a.exit().transition(t.transition).call(s,t.exit).remove();var c=u.merge(a);c.transition(t.transition).call(s,t.update);return c}function m(e,n){if(n===void 0)n={};var r=new Set(t.merge(e.map(function(e){return i.keys(e)}))),o={};r.forEach(function(r){var i=e.map(function(e){return e[r]});var f;if(n[r]){f=n[r](i)}else{var a=i.map(function(e){return e||e===false?e.constructor:e}).filter(function(e){return e!==void 0});if(!a.length){f=undefined}else if(a.indexOf(Array)>=0){f=t.merge(i.map(function(e){return e instanceof Array?e:[e]}));f=Array.from(new Set(f));if(f.length===1){f=f[0]}}else if(a.indexOf(String)>=0){f=Array.from(new Set(i));if(f.length===1){f=f[0]}}else if(a.indexOf(Number)>=0){f=t.sum(i)}else if(a.indexOf(Object)>=0){f=m(i.filter(function(e){return e}))}else{f=Array.from(new Set(i.filter(function(e){return e!==void 0})));if(f.length===1){f=f[0]}}}o[r]=f});return o}function b(e){var n=e.split(/\s+/);if(n.length===1){n=[n[0],n[0],n[0],n[0]]}else if(n.length===2){n=n.concat(n)}else if(n.length===3){n.push(n[1])}return["top","right","bottom","left"].reduce(function(e,r,t){var i=parseFloat(n[t]);e[r]=i||0;return e},{})}function _(){if("-webkit-transform"in document.body.style){return"-webkit-"}else if("-moz-transform"in document.body.style){return"-moz-"}else if("-ms-transform"in document.body.style){return"-ms-"}else if("-o-transform"in document.body.style){return"-o-"}else{return""}}function O(e,n){if(n===void 0)n={};for(var r in n){if({}.hasOwnProperty.call(n,r)){e.style(r,n[r])}}}e.accessor=o;e.assign=a;e.attrize=s;e.BaseClass=h;e.closest=v;e.configPrep=y;e.constant=p;e.elem=g;e.isObject=f;e.merge=m;e.parseSides=b;e.prefix=_;e.RESET=l;e.stylize=O;e.uuid=c;Object.defineProperty(e,"__esModule",{value:true})});

@@ -11,2 +11,3 @@ export {default as accessor} from "./src/accessor";

export {default as merge} from "./src/merge";
export {default as parseSides} from "./src/parseSides";
export {default as prefix} from "./src/prefix";

@@ -13,0 +14,0 @@ export {default as RESET} from "./src/RESET";

{
"name": "d3plus-common",
"version": "0.6.31",
"version": "0.6.32",
"description": "Common functions and methods used across D3plus modules.",

@@ -40,3 +40,3 @@ "main": "build/d3plus-common.js",

"devDependencies": {
"d3plus-dev": "^0.5.3"
"d3plus-dev": "^0.6.1"
},

@@ -43,0 +43,0 @@ "module": "es/index",

# d3plus-common
[![NPM Release](http://img.shields.io/npm/v/d3plus-common.svg?style=flat)](https://www.npmjs.org/package/d3plus-common) [![Build Status](https://travis-ci.org/d3plus/d3plus-common.svg?branch=master)](https://travis-ci.org/d3plus/d3plus-common) [![Dependency Status](http://img.shields.io/david/d3plus/d3plus-common.svg?style=flat)](https://david-dm.org/d3plus/d3plus-common) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat)](https://gitter.im/d3plus/)
[![NPM Release](http://img.shields.io/npm/v/d3plus-common.svg?style=flat)](https://www.npmjs.org/package/d3plus-common) [![Build Status](https://travis-ci.org/d3plus/d3plus-common.svg?branch=master)](https://travis-ci.org/d3plus/d3plus-common) [![Dependency Status](http://img.shields.io/david/d3plus/d3plus-common.svg?style=flat)](https://david-dm.org/d3plus/d3plus-common) [![Gitter](https://img.shields.io/badge/-chat_on_gitter-brightgreen.svg?style=flat&logo=gitter-white)](https://gitter.im/d3plus/)

@@ -31,2 +31,3 @@ Common functions and methods used across D3plus modules.

* [merge](#merge) - Combines an Array of Objects together and returns a new Object.
* [parseSides](#parseSides) - Converts a string of directional CSS shorthand values into an object with the values expanded.
* [prefix](#prefix) - Returns the appropriate CSS vendor prefix, given the current browser.

@@ -271,2 +272,12 @@ * [stylize](#stylize) - Applies each key/value in an object as a style.

<a name="parseSides"></a>
#### d3plus.**parseSides**(sides) [<>](https://github.com/d3plus/d3plus-common/blob/master/src/parseSides.js#L1)
Converts a string of directional CSS shorthand values into an object with the values expanded.
This is a global function.
---
<a name="prefix"></a>

@@ -318,2 +329,2 @@ #### d3plus.**prefix**() [<>](https://github.com/d3plus/d3plus-common/blob/master/src/prefix.js#L1)

###### <sub>Documentation generated on Fri, 29 Dec 2017 15:45:57 GMT</sub>
###### <sub>Documentation generated on Tue, 27 Feb 2018 17:34:47 GMT</sub>

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