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

breakdancer

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breakdancer - npm Package Compare versions

Comparing version 3.0.2 to 4.0.0

lib/test.js

4

CHANGELOG.md
# CHANGELOG
### 4.0.0
- Upgrade to `babel@7`.
### 3.0.2

@@ -4,0 +8,0 @@

42

lib/breakdancer.js

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

'use strict';
"use strict";

@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**

@@ -19,3 +22,5 @@ * Breakdancer is a simple breakpoint utility.

*/
var Breakdancer = function () {
var Breakdancer =
/*#__PURE__*/
function () {
function Breakdancer(specification) {

@@ -30,3 +35,2 @@ _classCallCheck(this, Breakdancer);

}
/**

@@ -42,12 +46,10 @@ * Normalize the specification.

_createClass(Breakdancer, [{
key: 'normalize',
key: "normalize",
value: function normalize(specification) {
if (Array.isArray(specification)) return specification;
return Object.keys(specification).reduce(function reduce(memo, key) {
var breakpoint = specification[key];
//
var breakpoint = specification[key]; //
// If there is no name specified, use the key as name.
//
breakpoint.name = breakpoint.name || key;

@@ -58,3 +60,2 @@ memo.push(breakpoint);

}
/**

@@ -69,10 +70,8 @@ * Check if the setup has changed since we've last checked the real estate.

}, {
key: 'changed',
key: "changed",
value: function changed(viewport) {
var breakpoint = this.breakpoint;
this.breakpoint = this.currently(viewport);
return this.breakpoint !== breakpoint;
}
/**

@@ -88,6 +87,5 @@ * Check if a given specification matches our current set resolution.

}, {
key: 'matches',
key: "matches",
value: function matches(viewport, specification) {
viewport = viewport || this.viewport();
var matched = false;

@@ -97,3 +95,2 @@

matched = viewport.height < specification.height;
if (!matched) return matched;

@@ -108,3 +105,2 @@ }

}
/**

@@ -119,3 +115,3 @@ * Find out which breakpoint we're currently triggering.

}, {
key: 'currently',
key: "currently",
value: function currently(viewport) {

@@ -126,3 +122,2 @@ viewport = viewport || this.viewport();

var spec = this.specification[i];
if (this.matches(viewport, spec)) return spec.name;

@@ -133,3 +128,2 @@ }

}
/**

@@ -149,3 +143,3 @@ * Returns the difference between the current width and the given breakpoint. This

}, {
key: 'compare',
key: "compare",
value: function compare(breakpoint, property) {

@@ -157,7 +151,7 @@ var desiredSpec = this.specification.filter(function (spec) {

if (!desiredSpec) {
return new TypeError(breakpoint + ' is not part of the given specifications');
return new TypeError("".concat(breakpoint, " is not part of the given specifications"));
}
if (!desiredSpec[property]) {
return new TypeError(breakpoint + '.' + property + ' is not part of the given specifications');
return new TypeError("".concat(breakpoint, ".").concat(property, " is not part of the given specifications"));
}

@@ -164,0 +158,0 @@

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

'use strict';
"use strict";

@@ -6,21 +6,28 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _breakdancer = _interopRequireDefault(require("./breakdancer"));
var _breakdancer = require('./breakdancer');
var _propget = _interopRequireDefault(require("propget"));
var _breakdancer2 = _interopRequireDefault(_breakdancer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propget = require('propget');
function _typeof(obj) { 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); }
var _propget2 = _interopRequireDefault(_propget);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
/**

@@ -38,3 +45,2 @@ * Small fallback for when the `window` global is not accessible in a given

};
/**

@@ -49,10 +55,13 @@ * Breakdancer is a simple breakpoint utility.

var WebDancer = function (_Breakdancer) {
var WebDancer =
/*#__PURE__*/
function (_Breakdancer) {
_inherits(WebDancer, _Breakdancer);
function WebDancer(specification, windows) {
var _this;
_classCallCheck(this, WebDancer);
var _this = _possibleConstructorReturn(this, (WebDancer.__proto__ || Object.getPrototypeOf(WebDancer)).call(this, specification));
_this = _possibleConstructorReturn(this, _getPrototypeOf(WebDancer).call(this, specification));
_this.window = windows || win;

@@ -62,3 +71,2 @@ _this.breakpoint = _this.currently();

}
/**

@@ -73,3 +81,3 @@ * Return the current view port.

_createClass(WebDancer, [{
key: 'viewport',
key: "viewport",
value: function viewport() {

@@ -81,3 +89,2 @@ return {

}
/**

@@ -91,7 +98,6 @@ * Lookup the view port width.

}, {
key: 'width',
key: "width",
value: function width() {
return (0, _propget2.default)(this.window, 'innerWidth') || (0, _propget2.default)(this.window, 'document.documentElement.clientWidth') || (0, _propget2.default)(this.window, 'document.body.clientWidth') || 0;
return (0, _propget.default)(this.window, 'innerWidth') || (0, _propget.default)(this.window, 'document.documentElement.clientWidth') || (0, _propget.default)(this.window, 'document.body.clientWidth') || 0;
}
/**

@@ -105,5 +111,5 @@ * Lookup the view port height.

}, {
key: 'height',
key: "height",
value: function height() {
return (0, _propget2.default)(this.window, 'innerHeight') || (0, _propget2.default)(this.window, 'document.documentElement.clientHeight') || (0, _propget2.default)(this.window, 'document.body.clientHeight') || 0;
return (0, _propget.default)(this.window, 'innerHeight') || (0, _propget.default)(this.window, 'document.documentElement.clientHeight') || (0, _propget.default)(this.window, 'document.body.clientHeight') || 0;
}

@@ -113,4 +119,4 @@ }]);

return WebDancer;
}(_breakdancer2.default);
}(_breakdancer.default);
exports.default = WebDancer;

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

'use strict';
"use strict";

@@ -6,19 +6,28 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _breakdancer = _interopRequireDefault(require("./breakdancer"));
var _breakdancer = require('./breakdancer');
var _reactNative = require("react-native");
var _breakdancer2 = _interopRequireDefault(_breakdancer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _reactNative = require('react-native');
function _typeof(obj) { 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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
/**

@@ -31,14 +40,16 @@ * Breakdancer is a simple breakpoint utility.

*/
var NativeDancer = function (_Breakdancer) {
var NativeDancer =
/*#__PURE__*/
function (_Breakdancer) {
_inherits(NativeDancer, _Breakdancer);
function NativeDancer(specification) {
var _this;
_classCallCheck(this, NativeDancer);
var _this = _possibleConstructorReturn(this, (NativeDancer.__proto__ || Object.getPrototypeOf(NativeDancer)).call(this, specification));
_this = _possibleConstructorReturn(this, _getPrototypeOf(NativeDancer).call(this, specification));
_this.breakpoint = _this.currently();
return _this;
}
/**

@@ -53,7 +64,6 @@ * Return the current view port.

_createClass(NativeDancer, [{
key: 'viewport',
key: "viewport",
value: function viewport() {
return _reactNative.Dimensions.get('window');
}
/**

@@ -67,7 +77,6 @@ * Lookup the view port width.

}, {
key: 'width',
key: "width",
value: function width() {
return _reactNative.Dimensions.get('window').width;
}
/**

@@ -81,3 +90,3 @@ * Lookup the view port height.

}, {
key: 'height',
key: "height",
value: function height() {

@@ -89,4 +98,4 @@ return _reactNative.Dimensions.get('window').height;

return NativeDancer;
}(_breakdancer2.default);
}(_breakdancer.default);
exports.default = NativeDancer;
{
"name": "breakdancer",
"version": "3.0.2",
"version": "4.0.0",
"description": "A breakpoint tracking utility",
"main": "./lib",
"browser": "./index",
"browser": "./lib",
"module": "./index",
"scripts": {
"lint": "eslint-godaddy *.js",
"test:platforms": "mocha --require react-native-mock/mock.js --require babel-register ./test.js ./test.native.js",
"build": "babel index.js index.native.js breakdancer.js -d ./lib",
"test:platforms": "mocha --require react-native-mock/mock.js --require @babel/register ./test.js ./test.native.js",
"build": "babel *.js -d ./lib",
"prepublish": "npm run build",

@@ -30,8 +31,9 @@ "pretest": "npm run lint",

"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"assume": "^1.5.2",
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.0",
"babel-register": "^6.26.0",
"coveralls": "^3.0.0",
"eslint": "^4.17.0",
"eslint": "^5.12.1",
"eslint-config-godaddy": "^2.0.0",

@@ -41,15 +43,10 @@ "eslint-plugin-json": "^1.2.0",

"mocha": "^5.0.0",
"nyc": "^11.4.1",
"nyc": "^13.2.0",
"pre-commit": "^1.2.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-native": "^0.42.3",
"react-native": "^0.58.3",
"react-native-mock": "^0.3.1"
},
"pre-commit": "lint, test",
"browserify": {
"transform": [
"babelify"
]
},
"dependencies": {

@@ -60,3 +57,3 @@ "propget": "^1.1.0"

"presets": [
"babel-preset-es2015"
"@babel/preset-env"
]

@@ -63,0 +60,0 @@ },

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