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

bootstrap-detect-breakpoint

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-detect-breakpoint - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

index.html

2

package.json
{
"name": "bootstrap-detect-breakpoint",
"version": "1.0.1",
"version": "1.0.2",
"description": "Detect the current Bootstrap 4 breakpoint in JavaScript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,5 +18,12 @@ # bootstrap-detect-breakpoint

```
which will return an object with the current breakpoint name and index,
like this
which will return "xs", "sm", "md", "lg" or "xl".
```json
{
"name": "lg",
"index": 3
}
```
The index goes fro 0-4, where 0 is "xs" and 4 is "xl".

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

const DetectBreakpoint = (function() {
const DetectBreakpoint = (function () {
const breakpointNames = ["xl", "lg", "md", "sm", "xs"]

@@ -9,5 +9,7 @@ let breakpointValues = []

current: () => {
let i = breakpointNames.length
for (const breakpointName of breakpointNames) {
if(window.matchMedia("(min-width: " + breakpointValues[breakpointName] + ")").matches) {
return breakpointName
i--
if (window.matchMedia("(min-width: " + breakpointValues[breakpointName] + ")").matches) {
return {name: breakpointName, index: i}
}

@@ -18,2 +20,2 @@ }

}
})();
})()
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