ofo-helpers
Advanced tools
Comparing version 1.0.8 to 1.0.9
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 | ||
} |
{ | ||
"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 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
3798
4
91
0