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

import-regex

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-regex - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

LICENSE.md

10

index.js

@@ -6,7 +6,13 @@ 'use strict';

*
* @param {Object} opts
* @api public
*/
module.exports = function () {
return /@import\s+(?:url\s?\((?:[^)]+)\))|@import\s+(\'|")(?:.*)\1/gi;
module.exports = function (opts) {
opts = opts || {};
var regex = '(?:@import)(?:\\s)(?:url)?(?:(?:(?:\\()(["\'])?(?:[^"\')]+)\\1(?:\\))|(["\'])(?:.+)\\2)(?:[A-Z\\s])*)+(?:;)';
return opts.exact ? new RegExp('(?:^' + regex + '$)', 'i') :
new RegExp('(?:^|\\s)?' + regex, 'gi');
};

4

package.json
{
"name": "import-regex",
"version": "1.0.1",
"version": "1.1.0",
"description": "Regular expression for matching CSS @imports",

@@ -27,4 +27,4 @@ "license": "MIT",

"devDependencies": {
"ava": "0.0.4"
"ava": "^0.0.4"
}
}

@@ -16,10 +16,13 @@ # import-regex [![Build Status](https://travis-ci.org/kevva/import-regex.svg?branch=master)](https://travis-ci.org/kevva/import-regex)

importRegex().test('@import url(\'foo.css\');');
importRegex().test('@import url(\'foo.css\'); foo bar');
//=> true
importRegex().exec('This is a CSS import @import url(\'foo.css\');')[0].trim();
//=> @import url('foo.css')
importRegex({ exact: true }).test('@import url(\'foo.css\'); foo bar');
//=> false
'Multiple @import url(\'foo.css\'); @import url(\'bar.css\'); CSS imports'.match(importRegex());
//=> ['@import url('foo.css')', '@import url('bar.css')']
importRegex({ exact: true }).test('@import url(\'foo.css\');');
//=> true
'foo @import url(\'foo.css\'); bar @import url(\'bar.css\');'.match(importRegex());
//=> ['@import url('foo.css');', '@import url('bar.css');']
```

@@ -26,0 +29,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