New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gooddata/js-utils

Package Overview
Dependencies
Maintainers
22
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gooddata/js-utils - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1-pbenes-pb-tc-utils-2017-05-02T08-15-31-492Z

lib/utils/testcafe/runTest.js

6

lib/index.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
exports.env = exports.date = exports.string = undefined;

@@ -24,2 +22,2 @@

exports.date = dateUtils;
exports.env = envUtils;
exports.env = envUtils;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
exports.getDateTimeConfig = getDateTimeConfig;

@@ -48,2 +46,2 @@

};
}
}
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;
exports.isProductionHostname = isProductionHostname;

@@ -14,2 +12,2 @@ /**

return !(hostname === 'localhost' || /getgooddata\.com$/.test(hostname) || /intgdc\.com$/.test(hostname));
}
}
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__esModule = true;

@@ -19,2 +17,3 @@ var _isNumber2 = require('lodash/isNumber');

exports.simplifyText = simplifyText;
exports.parseStringToArray = parseStringToArray;

@@ -68,5 +67,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function simplifyText(str) {
var isValid = (0, _isString3.default)(str) || (0, _isNumber3.default)(str);
var isValid = ()(str) || ()(str);
var s = isValid ? str.toString() : '';
return s.replace(/[^a-zA-Z0-9]/g, '_').toLowerCase();
}
}
/**
* Parse string in a form of [foo, bar] to an array of objects.
* Assume alphanumeric strings in the array; if some is not alphanumeric , return null
* @param {String} str input string with the array definition
* @returns {Array} parsed array of strings
*/
function parseStringToArray(str) {
if (str) {
if (str.match(/^\[]$/)) {
// empty array of tags []
return [];
}
if (str.match(/^\[[a-zA-Z0-9]+(,[a-zA-Z0-9]+)*]$/)) {
// [foo], [foo,bar]
return str.slice(1, -1).split(',');
}
}
return null;
}
{
"name": "@gooddata/js-utils",
"version": "0.5.0",
"version": "0.5.1-pbenes-pb-tc-utils-2017-05-02T08-15-31-492Z",
"description": "Various utils shared on GoodData frontend",

@@ -21,3 +21,3 @@ "main": "lib/index.js",

"scripts": {
"build": "rm -rf lib && babel src --out-dir lib --ignore test",
"build": "grunt build",
"prepublish": "yarn run build"

@@ -30,2 +30,4 @@ },

"babel-plugin-lodash": "3.2.11",
"babel-preset-env": "1.4.0",
"babel-plugin-transform-runtime": "6.22.0",
"babel-preset-es2015": "6.22.0",

@@ -37,3 +39,5 @@ "babel-preset-stage-2": "6.22.0",

"grunt": "1.0.1",
"grunt-babel": "6.0.0",
"grunt-cli": "1.2.0",
"grunt-contrib-clean": "1.0.0",
"grunt-karma": "2.0.0",

@@ -40,0 +44,0 @@ "grunt-webpack": "1.0.14",

@@ -52,1 +52,23 @@ import { isString, isNumber } from 'lodash';

}
/**
* Parse string in a form of [foo, bar] to an array of objects.
* Assume alphanumeric strings in the array; if some is not alphanumeric , return null
* @param {String} str input string with the array definition
* @returns {Array} parsed array of strings
*/
export function parseStringToArray(str) {
if (str) {
if (str.match(/^\[]$/)) {
// empty array of tags []
return [];
}
if (str.match(/^\[[a-zA-Z0-9]+(,[a-zA-Z0-9]+)*]$/)) {
// [foo], [foo,bar]
return str.slice(1, -1).split(',');
}
}
return null;
}
import {
randomString,
shortenText,
simplifyText
simplifyText,
parseStringToArray
} from '../string';

@@ -40,1 +41,24 @@

});
describe('parseStringToArray', () => {
it('should parse string to array correctly', () => {
const tagsConfigs = [
// valid are empty [] and a-zA-Z0-9 separated by comma [asdf], [asdf,qwer], [asdf,2]
{ tag: '[]', result: [] },
{ tag: '[asdf]', result: ['asdf'] },
{ tag: '[asdf,qwer]', result: ['asdf', 'qwer'] },
{ tag: '[asdf,2]', result: ['asdf', '2'] },
// invalid
{ tag: '[asdf', result: null },
{ tag: 'asdf]', result: null },
{ tag: '[asdf, qwer]', result: null },
{ tag: '[asdf#]', result: null },
{ tag: '[asdf?]', result: null },
{ tag: '[asdf&]', result: null }
];
tagsConfigs.forEach((tagConfig) => {
expect(parseStringToArray(tagConfig.tag)).to.eql(tagConfig.result);
});
});
});
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