Socket
Socket
Sign inDemoInstall

ofo-helpers

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ofo-helpers - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

__tests__/mergeArraysOfObjectsUniqueById.spec.js

31

index.js

@@ -1,2 +0,2 @@

export const reorder_rectangle_points = points => {
const reorder_rectangle_points = points => {
const output = [];

@@ -42,7 +42,7 @@ let lowestX = Number.POSITIVE_INFINITY;

export const toTitle = str => !str ? '' : str.split(' ').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
const toTitle = str => !str ? '' : str.split(' ').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');
export const isDefined = i => typeof i != 'undefined' && i != null;
const isDefined = i => typeof i != 'undefined' && i != null;
export const isValidURL = str => {
const isValidURL = str => {
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol

@@ -57,3 +57,3 @@ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name

export const splitArray = (arr, n) => {
const splitArray = (arr, n) => {
const chunkLength = Math.floor(arr.length / n);

@@ -70,2 +70,23 @@ const chunks = [];

return chunks;
}
// params are arrays of arrays
function mergeArraysOfObjectsUniqueById() {
const temp = {};
for (let i = 0; i < arguments.length; i++) {
arguments[i].forEach(i => temp[i.id] = i);
}
let output = Object.keys(temp).map(key => temp[key]);
output.sort((a, b) => parseInt(a.id) - parseInt(b.id));
return output;
}
module.exports = {
mergeArraysOfObjectsUniqueById,
reorder_rectangle_points,
splitArray,
isValidURL,
isDefined,
toTitle
}

4

package.json
{
"name": "ofo-helpers",
"version": "1.0.8",
"version": "1.0.9",
"description": "OFO Tech Helpers",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest",
"deploy": "git add . && git commit -m 'bug fix' && git push && npm publish --access=public"

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