Socket
Socket
Sign inDemoInstall

string-process-comma-separated

Package Overview
Dependencies
0
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.5 to 1.2.6

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

## 1.2.6 (2020-04-26)
### Bug Fixes
- harden the eslint rules set, make all tests pass again and rebase a little ([8c2c0a8](https://gitlab.com/codsen/codsen/commit/8c2c0a8d1b0a0c195c853460ac4de117cee15033))
## 1.2.0 (2020-01-01)

@@ -8,0 +14,0 @@

57

dist/string-process-comma-separated.cjs.js
/**
* string-process-comma-separated
* Extracts chunks from possibly comma or whatever-separated string
* Version: 1.2.5
* Version: 1.2.6
* Author: Roy Revelt, Codsen Ltd

@@ -28,2 +28,51 @@ * License: MIT

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function processCommaSeparated(str, originalOpts) {

@@ -47,3 +96,3 @@ if (typeof str !== "string") {

};
var opts = Object.assign({}, defaults, originalOpts);
var opts = _objectSpread2({}, defaults, {}, originalOpts);
if (!Number.isInteger(originalOpts.from)) {

@@ -107,3 +156,3 @@ opts.from = 0;

if (i + 1 === opts.to && str[i] !== opts.separator && !str[i].trim()) {
endingIdx++;
endingIdx += 1;
}

@@ -113,3 +162,3 @@ var whatToAdd = "";

if (str[whitespaceStartsAt] === " " && str[whitespaceStartsAt - 1] === opts.separator) {
startingIdx++;
startingIdx += 1;
} else if (str[whitespaceStartsAt] !== " ") {

@@ -116,0 +165,0 @@ whatToAdd = " ";

/**
* string-process-comma-separated
* Extracts chunks from possibly comma or whatever-separated string
* Version: 1.2.5
* Version: 1.2.6
* Author: Roy Revelt, Codsen Ltd

@@ -32,2 +32,51 @@ * License: MIT

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function processCommaSeparated(str, originalOpts) {

@@ -55,4 +104,6 @@ // insurance:

};
var opts = Object.assign({}, defaults, originalOpts); // patch from/to values, they might have been given as nulls etc.
var opts = _objectSpread2({}, defaults, {}, originalOpts); // patch from/to values, they might have been given as nulls etc.
if (!Number.isInteger(originalOpts.from)) {

@@ -94,2 +145,3 @@ opts.from = 0;

if (separatorsArr.length > 1) {
// eslint-disable-next-line no-loop-func
separatorsArr.forEach(function (separatorsIdx, orderNumber) {

@@ -147,3 +199,3 @@ if (orderNumber) {

if (i + 1 === opts.to && str[i] !== opts.separator && !str[i].trim()) {
endingIdx++;
endingIdx += 1;
} // i + 1 === opts.to && str[i] !== opts.separator && str[i].trim()

@@ -159,3 +211,3 @@ // ? i + 1

// if first whitespace chunk's character is a space, leave it
startingIdx++;
startingIdx += 1;
} else if (str[whitespaceStartsAt] !== " ") {

@@ -223,2 +275,3 @@ // if first whitespace chunk's character is not a space,

if (i + 1 === opts.to) {
// eslint-disable-next-line no-loop-func
separatorsArr.forEach(function (separatorsIdx) {

@@ -225,0 +278,0 @@ opts.errCb([[separatorsIdx + opts.offset, separatorsIdx + 1 + opts.offset]], "Remove separator.", fixable);

8

dist/string-process-comma-separated.esm.js
/**
* string-process-comma-separated
* Extracts chunks from possibly comma or whatever-separated string
* Version: 1.2.5
* Version: 1.2.6
* Author: Roy Revelt, Codsen Ltd

@@ -34,3 +34,3 @@ * License: MIT

};
const opts = Object.assign({}, defaults, originalOpts);
const opts = { ...defaults, ...originalOpts };
if (!Number.isInteger(originalOpts.from)) {

@@ -150,3 +150,3 @@ opts.from = 0;

if (i + 1 === opts.to && str[i] !== opts.separator && !str[i].trim()) {
endingIdx++;
endingIdx += 1;
}

@@ -159,3 +159,3 @@ let whatToAdd = "";

) {
startingIdx++;
startingIdx += 1;
} else if (str[whitespaceStartsAt] !== " ") {

@@ -162,0 +162,0 @@ whatToAdd = " ";

/**
* string-process-comma-separated
* Extracts chunks from possibly comma or whatever-separated string
* Version: 1.2.5
* Version: 1.2.6
* Author: Roy Revelt, Codsen Ltd

@@ -10,2 +10,2 @@ * License: MIT

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).stringProcessCommaSeparated=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}return function(t,r){if("string"!=typeof t)throw new Error("string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ".concat(e(t),", equal to:\n").concat(JSON.stringify(t,null,4)));if(t.length&&(r.cb||r.errCb)){var o={from:0,to:t.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},f=Object.assign({},o,r);Number.isInteger(r.from)||(f.from=0),Number.isInteger(r.to)||(f.to=t.length),Number.isInteger(r.offset)||(f.offset=0);for(var n=null,s=null,a=!1,i=[],p=null,l=!0,m=f.from;m<f.to;m++){if(t[m].trim()&&t[m]!==f.separator&&(p=m),null!==n||!t[m].trim()||f.separator&&t[m]===f.separator||(a||(a=!0),i.length&&(i.length>1&&i.forEach((function(e,t){t&&f.errCb([[e+f.offset,e+1+f.offset]],"Remove separator.",l)})),i=[]),n=m),Number.isInteger(n)&&(m>n&&f.separator&&t[m]===f.separator||m+1===f.to)){t.slice(n,m+1===f.to&&t[m]!==f.separator&&t[m].trim()?m+1:m);"function"==typeof f.cb&&f.cb(n+f.offset,(m+1===f.to&&t[m]!==f.separator&&t[m].trim()?m+1:p+1)+f.offset),n=null}if(t[m].trim()||null!==s||(s=m),null!==s&&(t[m].trim()||m+1===f.to)){if(s===f.from)f.leadingWhitespaceOK||"function"!=typeof f.errCb||f.errCb([[s+f.offset,(m+1===f.to?m+1:m)+f.offset]],"Remove whitespace.",l);else if(t[m].trim()||m+1!==f.to){if(!(f.oneSpaceAfterCommaOK&&t[m].trim()&&m>f.from+1&&" "===t[m-1]&&","===t[m-2]||f.innerWhitespaceAllowed&&a&&t[s-1]&&t[m].trim()&&t[m]!==f.separator&&t[s-1]!==f.separator)){var c=s,u=m;m+1!==f.to||t[m]===f.separator||t[m].trim()||u++;var b="";f.oneSpaceAfterCommaOK&&(" "===t[s]&&t[s-1]===f.separator?c++:" "!==t[s]&&(b=" "));var h="Remove whitespace.";!f.innerWhitespaceAllowed&&a&&t[s-1]&&t[m].trim()&&t[m]!==f.separator&&t[s-1]!==f.separator&&(l=!1,h="Bad whitespace."),b.length?f.errCb([[c+f.offset,u+f.offset,b]],h,l):f.errCb([[c+f.offset,u+f.offset]],h,l),l=!0}}else f.trailingWhitespaceOK||"function"!=typeof f.errCb||f.errCb([[s+f.offset,m+1+f.offset]],"Remove whitespace.",l);s=null}t[m]===f.separator&&(a?i.push(m):f.errCb([[m+f.offset,m+1+f.offset]],"Remove separator.",l)),m+1===f.to&&i.forEach((function(e){f.errCb([[e+f.offset,e+1+f.offset]],"Remove separator.",l)}))}}}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).stringProcessCommaSeparated=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}return function(o,n){if("string"!=typeof o)throw new Error("string-process-comma-separated: [THROW_ID_01] input must be string! It was given as ".concat(e(o),", equal to:\n").concat(JSON.stringify(o,null,4)));if(o.length&&(n.cb||n.errCb)){var f=function(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?r(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},{from:0,to:o.length,offset:0,leadingWhitespaceOK:!1,trailingWhitespaceOK:!1,oneSpaceAfterCommaOK:!1,innerWhitespaceAllowed:!1,separator:",",cb:null,errCb:null},{},n);Number.isInteger(n.from)||(f.from=0),Number.isInteger(n.to)||(f.to=o.length),Number.isInteger(n.offset)||(f.offset=0);for(var i=null,a=null,s=!1,c=[],p=null,l=!0,u=f.from;u<f.to;u++){if(o[u].trim()&&o[u]!==f.separator&&(p=u),null!==i||!o[u].trim()||f.separator&&o[u]===f.separator||(s||(s=!0),c.length&&(c.length>1&&c.forEach((function(e,t){t&&f.errCb([[e+f.offset,e+1+f.offset]],"Remove separator.",l)})),c=[]),i=u),Number.isInteger(i)&&(u>i&&f.separator&&o[u]===f.separator||u+1===f.to)){o.slice(i,u+1===f.to&&o[u]!==f.separator&&o[u].trim()?u+1:u);"function"==typeof f.cb&&f.cb(i+f.offset,(u+1===f.to&&o[u]!==f.separator&&o[u].trim()?u+1:p+1)+f.offset),i=null}if(o[u].trim()||null!==a||(a=u),null!==a&&(o[u].trim()||u+1===f.to)){if(a===f.from)f.leadingWhitespaceOK||"function"!=typeof f.errCb||f.errCb([[a+f.offset,(u+1===f.to?u+1:u)+f.offset]],"Remove whitespace.",l);else if(o[u].trim()||u+1!==f.to){if(!(f.oneSpaceAfterCommaOK&&o[u].trim()&&u>f.from+1&&" "===o[u-1]&&","===o[u-2]||f.innerWhitespaceAllowed&&s&&o[a-1]&&o[u].trim()&&o[u]!==f.separator&&o[a-1]!==f.separator)){var m=a,b=u;u+1!==f.to||o[u]===f.separator||o[u].trim()||(b+=1);var y="";f.oneSpaceAfterCommaOK&&(" "===o[a]&&o[a-1]===f.separator?m+=1:" "!==o[a]&&(y=" "));var g="Remove whitespace.";!f.innerWhitespaceAllowed&&s&&o[a-1]&&o[u].trim()&&o[u]!==f.separator&&o[a-1]!==f.separator&&(l=!1,g="Bad whitespace."),y.length?f.errCb([[m+f.offset,b+f.offset,y]],g,l):f.errCb([[m+f.offset,b+f.offset]],g,l),l=!0}}else f.trailingWhitespaceOK||"function"!=typeof f.errCb||f.errCb([[a+f.offset,u+1+f.offset]],"Remove whitespace.",l);a=null}o[u]===f.separator&&(s?c.push(u):f.errCb([[u+f.offset,u+1+f.offset]],"Remove separator.",l)),u+1===f.to&&c.forEach((function(e){f.errCb([[e+f.offset,e+1+f.offset]],"Remove separator.",l)}))}}}}));
{
"name": "string-process-comma-separated",
"version": "1.2.5",
"version": "1.2.6",
"description": "Extracts chunks from possibly comma or whatever-separated string",

@@ -119,2 +119,5 @@ "license": "MIT",

],
"nyc-arg": [
"--exclude=**/*.umd.js"
],
"timeout": 0

@@ -129,4 +132,4 @@ },

"benchmark": "^2.1.4",
"lect": "^0.12.6",
"rollup": "^2.6.1",
"lect": "^0.12.8",
"rollup": "^2.7.2",
"rollup-plugin-ascii": "^0.0.3",

@@ -133,0 +136,0 @@ "rollup-plugin-babel": "^4.4.0",

@@ -58,5 +58,5 @@ # string-process-comma-separated

| ------------------------------------------------------------------------------------------------------- | --------------------- | -------------------------------------------- | ---- |
| Main export - **CommonJS version**, transpiled to ES5, contains `require` and `module.exports` | `main` | `dist/string-process-comma-separated.cjs.js` | 6 KB |
| Main export - **CommonJS version**, transpiled to ES5, contains `require` and `module.exports` | `main` | `dist/string-process-comma-separated.cjs.js` | 7 KB |
| **ES module** build that Webpack/Rollup understands. Untranspiled ES6 code with `import`/`export`. | `module` | `dist/string-process-comma-separated.esm.js` | 6 KB |
| **UMD build** for browsers, transpiled, minified, containing `iife`'s and has all dependencies baked-in | `browser` | `dist/string-process-comma-separated.umd.js` | 3 KB |
| **UMD build** for browsers, transpiled, minified, containing `iife`'s and has all dependencies baked-in | `browser` | `dist/string-process-comma-separated.umd.js` | 4 KB |

@@ -376,3 +376,3 @@ **[⬆ back to top](#)**

[gitlab-url]: https://gitlab.com/codsen/codsen/tree/master/packages/string-process-comma-separated
[cov-img]: https://img.shields.io/badge/coverage-92.41%25-brightgreen.svg?style=flat-square
[cov-img]: https://img.shields.io/badge/coverage-94.44%25-brightgreen.svg?style=flat-square
[cov-url]: https://gitlab.com/codsen/codsen/tree/master/packages/string-process-comma-separated

@@ -379,0 +379,0 @@ [no-deps-img]: https://img.shields.io/badge/-no%20dependencies-brightgreen?style=flat-square

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc