🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

sass-maps-to-json

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sass-maps-to-json - npm Package Compare versions

Comparing version

to
1.4.0

34

index.js

@@ -1,8 +0,7 @@

var
_ = require('lodash'),
fs = require('fs'),
chalk = require('chalk'),
jsonfile = require('jsonfile');
import lodash from 'lodash';
import fs from 'fs';
import chalk from 'chalk';
import jsonfile from 'jsonfile';
module.exports = convertFile;
export default convertFile

@@ -27,3 +26,4 @@ function convertFile(settings) {

values.forEach(function (item) {
if (_.includes(item, '(')) {
let swatch;
if (lodash.includes(item, '(')) {
level = level + 2;

@@ -34,5 +34,5 @@ colorsGroupTempName = item[0];

};
} else if (_.includes(item, ')')) {
} else if (lodash.includes(item, ')')) {
level = level - 2;
colorsGroup = _.merge(colorsGroup, colorsGroupTemp);
colorsGroup = lodash.merge(colorsGroup, colorsGroupTemp);
} else {

@@ -45,3 +45,3 @@ if (level === 0) {

otherGroup["Other"].swatches.push(swatch);
colorsGroup = _.merge(colorsGroup, otherGroup);
colorsGroup = lodash.merge(colorsGroup, otherGroup);
} else if (level > 0) {

@@ -61,9 +61,10 @@ colorsGroupTemp[capitalizeFirstLetter(colorsGroupTempName)].swatches.push({

function readCss(settings) {
let newArray;
// split at new lines, and then filter out lines that start with $ (i.e. map name)
var data = _.filter(fs.readFileSync(settings.src, 'utf8').split('\n'), item => !_.startsWith(item, '$'));
var data = lodash.filter(fs.readFileSync(settings.src, 'utf8').split('\n'), item => !lodash.startsWith(item, '$'));
// filter out any comments in the map, trimming leading whitespace
data = _.filter(data, item => !_.startsWith(_.trimStart(item), '/'));
data = lodash.filter(data, item => !lodash.startsWith(lodash.trimStart(item), '/'));
newArray = [];
let map = _.map(data, (item) => {
let x = _.split(item, ':');
let map = lodash.map(data, (item) => {
let x = lodash.split(item, ':');

@@ -73,3 +74,3 @@ filterData(x);

});
newArray = _.filter(newArray, function (sub) {
newArray = lodash.filter(newArray, function (sub) {
return sub.length;

@@ -81,3 +82,2 @@ });

function filterData(x) {
filterArray = [];
for (var i = 0; i < x.length; i++) {

@@ -117,2 +117,2 @@ x[i] = x[i].replace(/default/, '').replace(/!/, '').replace(/\s/g, '').replace(/,/g, '').replace(/;/g, '').trim();

})
}
}
{
"name": "sass-maps-to-json",
"version": "1.3.0",
"version": "1.4.0",
"description": "Convert SCSS (or SASS) maps to JSON format for use in Fractal.",
"main": "index.js",
"exports": "./index.js",
"type": "module",
"keywords": [

@@ -22,3 +23,6 @@ "Fractal",

"lodash": "^4.17.21"
},
"engines": {
"node": ">=12.20.0"
}
}