Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
grid-util-js
Advanced tools
JavaScript utilities for handling [Grid] URLs and API.
Through npm
npm install --save grid-util-js
or jspm
jspm install npm:grid-util-js
You need a modern browsers implementing fetch
and Promise
or you can polyfill those methods.
import GridUtils from 'grid-util-js';
var grid = new GridUtils({
apiBaseUrl: 'http://root.api.of.grid'
});
Finds the Grid image ID in an URL. The URL can be anything, the media or crop link, or the link of the public image as long as the media ID is inside the URL.
grid.excractMediaId('http://deployed.image/12345...abcde')
Returns and object containing
{
id: 'grid id',
crop: 'crop id, if present'
}
Calls the API to retrieve the image information. It uses hypermedia Grid API.
grid.getImage('12345...abcde')
Returns a promise that resolves with the JSON response or rejects in case of error.
Get a specified crop from the image API response.
grid.filterCrops(apiResponse)
returns all cropsgrid.filterCrops(apiResponse, 'crop_id')
returns the crop with id crop_id
grid.filterCrops(apiResponse, filterFunction)
returns all crops matching filterFunction
.filterFunction
receives as only parameter the crop data.
When dragging a crop from the Grid, the crop information is inside the event dataTransfer
.
grid.getCropFromEvent(evt)
Returns a JSON object.
When dragging a crop from the Grid, the event dataTransfer
contains the original image URL in the Grid.
grid.getGridUrlFromEvent(evt)
Returns the URL as a string.
FAQs
JS helpers for the Grid
We found that grid-util-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.