
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
project-helpers
Advanced tools
Tiny library with some fun uses. Honestly, this is just my first NPM package, so more of a test for me really. But everything should work fine.
npm install project-helpers
import {helpers, mapObj, setDeep, ifFunc, arrayChunks} from "project-helpers"
This method is good for creating grids and any other things that require an array to be sorted into chunks.
const testArray = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const resulta = arrayChunks(testArray, 3);
const resultb = arrayChunks(testArray, 4);
// resulta is: [[1,2,3], [4, 5, 6], [7, 8, 9]]
// resultb is: [[1,2,3, 4], [5, 6, 7, 8], [9]]
Sometimes we just need to reach a bit deeper than we'd like but are unsure if the pathway is even set.
Use this method to safely access deeply nested values.
const deepObject = {layer_one: {layer_two: {layer_three: { worked: "worked"}}}};
const result = accessDeep("layer_one.layer_two.layer_three.worked", deepObject);
result should be "worked"
Do you need to iterate through an object's values? Here you go. You're welcome:
const objectMap = {
one: 1,
two: 2,
three: 3
};
const result = mapObj(objectMap, function (val) {
return val;
});
result should be [1, 2, 3]
If you need to deeply set a value of an object, we can do so using the setDeep method. This will create the path even though it's not already set.
let myObject = {};
helpers.setDeep(myObject, "set.deeply.nested.values", "myValue");
// myObject.set.deeply.nested.values = "myValue";
// Now it should look like this:
myObject = { set: { deeply: { nested: { values: "myValue" }}}};
Sometimes in projects we need to call functions if they are indeed functions. For example, in a React project sometimes we have props that are optional. These props can contain functions. If that is indeed the case, we would end up writing something like this:
if (typeof myfunc === "function") {
myfunc(...)
}
Well, we think even the one-liner solution of this sucks. So we created better:
const myFunction = function (a, b) {
return a + b;
}
ifFunc(myFunction, 1, 2) // should return 3;
This will gracefully fail if the function is not set.
npm test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
FAQs
Project Helpers =========
We found that project-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.