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

@gilbarbara/helpers

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gilbarbara/helpers - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

1

esm/arrays.d.ts

@@ -24,1 +24,2 @@ import { SortFunction } from './types';

export declare function sortComparator(left: string | number, right: string | number): 1 | -1 | 0;
export declare function splitIntoChunks<T>(array: T[], chunkSize?: number): T[][];

@@ -146,2 +146,10 @@ var __rest = (this && this.__rest) || function (s, e) {

}
export function splitIntoChunks(array, chunkSize) {
if (chunkSize === void 0) { chunkSize = 25; }
var chunks = [];
for (var index = 0; index < Math.ceil(array.length / chunkSize); index++) {
chunks.push(array.slice(index * chunkSize, (index + 1) * chunkSize));
}
return chunks;
}
//# sourceMappingURL=arrays.js.map

2

esm/date.js

@@ -26,3 +26,3 @@ import { pluralize } from './strings';

var output = function (value, caption) {
return "" + (prefix ? prefix + " " : '') + value + " " + caption + (suffix ? " " + suffix : '');
return "".concat(prefix ? "".concat(prefix, " ") : '').concat(value, " ").concat(caption).concat(suffix ? " ".concat(suffix) : '');
};

@@ -29,0 +29,0 @@ if (quantity >= 1) {

@@ -103,3 +103,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (Constructable === void 0) { Constructable = TypeError; }
throw new Constructable("\"" + input + "\" is required");
throw new Constructable("\"".concat(input, "\" is required"));
}

@@ -115,11 +115,11 @@ /**

var date = new Date();
var parts = ["%c " + type];
var styles = ["color: " + typeColor + "; font-weight: lighter;", 'color: inherit;'];
var parts = ["%c ".concat(type)];
var styles = ["color: ".concat(typeColor, "; font-weight: lighter;"), 'color: inherit;'];
if (!hideTimestamp) {
styles.push('color: gray; font-weight: lighter;');
}
var time = pad(date.getHours(), 2) + ":" + pad(date.getMinutes(), 2) + ":" + pad(date.getSeconds(), 2);
parts.push("%c" + title);
var time = "".concat(pad(date.getHours(), 2), ":").concat(pad(date.getMinutes(), 2), ":").concat(pad(date.getSeconds(), 2));
parts.push("%c".concat(title));
if (!hideTimestamp) {
parts.push("%c@ " + time);
parts.push("%c@ ".concat(time));
}

@@ -176,3 +176,3 @@ /* istanbul ignore else */

var top = screenHeight / 2 - height / 2 + screenTop;
var popup = window.open(url, title, "menubar=no,location=no,resizable=no,scrollbars=yees,status=no,width=" + width + ",height=" + height + ",top=" + top + ", left=" + left);
var popup = window.open(url, title, "menubar=no,location=no,resizable=no,scrollbars=yees,status=no,width=".concat(width, ",height=").concat(height, ",top=").concat(top, ", left=").concat(left));
/* istanbul ignore else */

@@ -179,0 +179,0 @@ if (popup) {

@@ -22,3 +22,3 @@ /**

if (length === void 0) { length = 2; }
return ("" + input).padStart(length, '0');
return "".concat(input).padStart(length, '0');
}

@@ -25,0 +25,0 @@ /**

@@ -120,3 +120,3 @@ var __read = (this && this.__read) || function (o, n) {

var _b = __read(_a, 2), value = _b[1];
return (includeOnly ? typeof value === "" + includeOnly : true);
return (includeOnly ? typeof value === "".concat(includeOnly) : true);
}) // eslint-disable-line valid-typeof

@@ -200,7 +200,7 @@ .map(function (_a) {

var nextKey = encodeValuesOnly ? key : encoder(key);
var nextValue = is.array(value) ? value.map(encoder).join(',') : encoder("" + value);
return nextKey + "=" + nextValue;
var nextValue = is.array(value) ? value.map(encoder).join(',') : encoder("".concat(value));
return "".concat(nextKey, "=").concat(nextValue);
})
.join('&');
return "" + (addPrefix ? '?' : '') + output;
return "".concat(addPrefix ? '?' : '').concat(output);
}

@@ -207,0 +207,0 @@ /**

@@ -45,5 +45,5 @@ var __read = (this && this.__read) || function (o, n) {

if (names.length === 1) {
return "" + names[0].charAt(0);
return "".concat(names[0].charAt(0));
}
return "" + names[0].charAt(0) + names[names.length - 1].charAt(0);
return "".concat(names[0].charAt(0)).concat(names[names.length - 1].charAt(0));
}

@@ -59,3 +59,3 @@ /**

}
return plural || singular + "s";
return plural || "".concat(singular, "s");
}

@@ -62,0 +62,0 @@ /**

@@ -24,1 +24,2 @@ import { SortFunction } from './types';

export declare function sortComparator(left: string | number, right: string | number): 1 | -1 | 0;
export declare function splitIntoChunks<T>(array: T[], chunkSize?: number): T[][];

@@ -39,3 +39,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.sortComparator = exports.sortByPrimitive = exports.sortByLocaleCompare = exports.quickSort = exports.getRandomItem = void 0;
exports.splitIntoChunks = exports.sortComparator = exports.sortByPrimitive = exports.sortByLocaleCompare = exports.quickSort = exports.getRandomItem = void 0;
/**

@@ -155,2 +155,11 @@ * Get a random item from an array

exports.sortComparator = sortComparator;
function splitIntoChunks(array, chunkSize) {
if (chunkSize === void 0) { chunkSize = 25; }
var chunks = [];
for (var index = 0; index < Math.ceil(array.length / chunkSize); index++) {
chunks.push(array.slice(index * chunkSize, (index + 1) * chunkSize));
}
return chunks;
}
exports.splitIntoChunks = splitIntoChunks;
//# sourceMappingURL=arrays.js.map

@@ -31,3 +31,3 @@ "use strict";

var output = function (value, caption) {
return "" + (prefix ? prefix + " " : '') + value + " " + caption + (suffix ? " " + suffix : '');
return "".concat(prefix ? "".concat(prefix, " ") : '').concat(value, " ").concat(caption).concat(suffix ? " ".concat(suffix) : '');
};

@@ -34,0 +34,0 @@ if (quantity >= 1) {

@@ -108,3 +108,3 @@ "use strict";

if (Constructable === void 0) { Constructable = TypeError; }
throw new Constructable("\"" + input + "\" is required");
throw new Constructable("\"".concat(input, "\" is required"));
}

@@ -121,11 +121,11 @@ exports.isRequired = isRequired;

var date = new Date();
var parts = ["%c " + type];
var styles = ["color: " + typeColor + "; font-weight: lighter;", 'color: inherit;'];
var parts = ["%c ".concat(type)];
var styles = ["color: ".concat(typeColor, "; font-weight: lighter;"), 'color: inherit;'];
if (!hideTimestamp) {
styles.push('color: gray; font-weight: lighter;');
}
var time = (0, numbers_1.pad)(date.getHours(), 2) + ":" + (0, numbers_1.pad)(date.getMinutes(), 2) + ":" + (0, numbers_1.pad)(date.getSeconds(), 2);
parts.push("%c" + title);
var time = "".concat((0, numbers_1.pad)(date.getHours(), 2), ":").concat((0, numbers_1.pad)(date.getMinutes(), 2), ":").concat((0, numbers_1.pad)(date.getSeconds(), 2));
parts.push("%c".concat(title));
if (!hideTimestamp) {
parts.push("%c@ " + time);
parts.push("%c@ ".concat(time));
}

@@ -185,3 +185,3 @@ /* istanbul ignore else */

var top = screenHeight / 2 - height / 2 + screenTop;
var popup = window.open(url, title, "menubar=no,location=no,resizable=no,scrollbars=yees,status=no,width=" + width + ",height=" + height + ",top=" + top + ", left=" + left);
var popup = window.open(url, title, "menubar=no,location=no,resizable=no,scrollbars=yees,status=no,width=".concat(width, ",height=").concat(height, ",top=").concat(top, ", left=").concat(left));
/* istanbul ignore else */

@@ -188,0 +188,0 @@ if (popup) {

@@ -27,3 +27,3 @@ "use strict";

if (length === void 0) { length = 2; }
return ("" + input).padStart(length, '0');
return "".concat(input).padStart(length, '0');
}

@@ -30,0 +30,0 @@ exports.pad = pad;

@@ -127,3 +127,3 @@ "use strict";

var _b = __read(_a, 2), value = _b[1];
return (includeOnly ? typeof value === "" + includeOnly : true);
return (includeOnly ? typeof value === "".concat(includeOnly) : true);
}) // eslint-disable-line valid-typeof

@@ -210,7 +210,7 @@ .map(function (_a) {

var nextKey = encodeValuesOnly ? key : encoder(key);
var nextValue = is_lite_1.default.array(value) ? value.map(encoder).join(',') : encoder("" + value);
return nextKey + "=" + nextValue;
var nextValue = is_lite_1.default.array(value) ? value.map(encoder).join(',') : encoder("".concat(value));
return "".concat(nextKey, "=").concat(nextValue);
})
.join('&');
return "" + (addPrefix ? '?' : '') + output;
return "".concat(addPrefix ? '?' : '').concat(output);
}

@@ -217,0 +217,0 @@ exports.queryStringFormat = queryStringFormat;

@@ -51,5 +51,5 @@ "use strict";

if (names.length === 1) {
return "" + names[0].charAt(0);
return "".concat(names[0].charAt(0));
}
return "" + names[0].charAt(0) + names[names.length - 1].charAt(0);
return "".concat(names[0].charAt(0)).concat(names[names.length - 1].charAt(0));
}

@@ -66,3 +66,3 @@ exports.getInitials = getInitials;

}
return plural || singular + "s";
return plural || "".concat(singular, "s");
}

@@ -69,0 +69,0 @@ exports.pluralize = pluralize;

{
"name": "@gilbarbara/helpers",
"version": "0.4.0",
"version": "0.4.1",
"description": "Collection of useful functions",

@@ -35,6 +35,6 @@ "keywords": [

"@size-limit/preset-small-lib": "^5.0.5",
"@types/jest": "^27.0.2",
"@types/node": "^16.11.7",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.12",
"@types/node-fetch": "^3.0.2",
"@types/react": "^17.0.34",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",

@@ -44,6 +44,6 @@ "del-cli": "^4.0.1",

"is-ci-cli": "^2.2.0",
"jest": "^27.3.1",
"jest": "^27.4.3",
"jest-chain": "^1.1.5",
"jest-date-mock": "^1.0.8",
"jest-extended": "^1.1.0",
"jest-extended": "^1.2.0",
"jest-fetch-mock": "^3.0.3",

@@ -54,5 +54,5 @@ "jest-serializer-html": "^7.1.0",

"size-limit": "^5.0.5",
"ts-jest": "^27.0.7",
"ts-jest": "^27.1.0",
"ts-node": "^10.4.0",
"typescript": "^4.4.4"
"typescript": "^4.5.2"
},

@@ -89,3 +89,3 @@ "scripts": {

"path": "./lib/index.js",
"limit": "12 kB"
"limit": "14 kB"
},

@@ -95,3 +95,3 @@ {

"path": "./esm/index.js",
"limit": "12 kB"
"limit": "14 kB"
}

@@ -98,0 +98,0 @@ ],

@@ -103,6 +103,9 @@ # @gilbarbara/helpers

**splitIntoChunks<T>(array: T[], chunkSize: number = 25): T[][]**
Split an array into chunks.
### Async
**cors(data: any, statusCode = 200, options?: CorsOptions): CorsOuput**
Returns a CORSresponse.
**cors(data: any, statusCode = 200, options?: CorsOptions)**
Returns an object with `body`, `headers` and `statusCode`.

@@ -109,0 +112,0 @@ <details>

@@ -142,1 +142,11 @@ import { AnyObject, NarrowPlainObject, SortFunction } from './types';

}
export function splitIntoChunks<T>(array: T[], chunkSize: number = 25): T[][] {
const chunks: T[][] = [];
for (let index = 0; index < Math.ceil(array.length / chunkSize); index++) {
chunks.push(array.slice(index * chunkSize, (index + 1) * chunkSize));
}
return chunks;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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