
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
direct-to-sides
Advanced tools
This library can be used to dynamically set direction (rtl, ltr) for a set of elements based on their position relative to their parent element(s).
This library can be used to dynamically ensure all child elements of a given CSS selector have their direction property set according to their position relative to their parent. On page-load the elements' positions are measured, elements nearest the left edge of thier parent are set direction: ltr, elements nearest the right edge of their parent are set direction: rtl, and if a tolerance value is provided elements further than the tolerance value from either edge are set direction: inherit. On a window resize (or orientation change on mobile) the positions are measured again and the directions reset to accomodate any shift in layout caused by the change in window size.
Additional triggers can be added via LayoutQueue.
Install via npm or yarn.
npm install direct-to-sides
OR
yarn add direct-to-sides
Then require this module within your javascript:
var DirectToSides = require('direct-to-sides');
The methods of DirectToSides all use standard CSS selectors, (e.g. 'p', '.class', '#id'). To align the children of a element or set of elements, pass the selector to init()
:
DirectToSides.init(selector);
A tolerance value in pixels can be added as a second parameter to set any child elements to direction: inherit;
if they are further than the given pixel value from either side. Without a tolerance value, all children will have a direction set either ltr, or rtl.
DirectToSides.init(selector, tolerance);
A third boolean parameter can be added to reverse the orientation, and align elements to the center rather than the sides. This parameter will default to false
.
var reverse = true;
DirectToSides.init(selector, tolerance, reverse);
A condition passed as a function can be added as a fourth parameter, allowing for a conditional applicaiton of the direction.
var condition = function () { return false }
DirectToSides.init(selector, tolerance, reverse, condition);
To manually unset the direction of an elements children use unset()
:
DirectToSides.unset(selector);
To manually set the directionof an elements children use 'set()';
DirectToSides.set(selector);
To add additional triggers for the execution of the queue see the documentation for LayoutQueue;
FAQs
This library can be used to dynamically set direction (rtl, ltr) for a set of elements based on their position relative to their parent element(s).
The npm package direct-to-sides receives a total of 0 weekly downloads. As such, direct-to-sides popularity was classified as not popular.
We found that direct-to-sides 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.