Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
array-string-at
Advanced tools
[…]
at()
, that is on the prototype of the built-in indexable objects:Array
,String
, andTypedArrays
objects. The method supports relative indexing from the end when passed a negative index.
npm install array-string-at --save
import at from 'array-string-at';
at('becky', 1); // e
at('becky', -2); // k
You can use named export preferNative
if you wish to use native
implementation if it’s available. In all other cases, ponyfill will be used.
Beware of
caveats!
import at from 'array-string-at';
if (typeof String.prototype.at === 'undefined') {
String.prototype.at = function (index) {
return at(this, index);
};
}
if (typeof Array.prototype.at === 'undefined') {
Array.prototype.at = function (index) {
return at(this, index);
};
}
Returns: *
Returns value at specified index. Supports relative indexing from the end when passed a negative index.
Type: string|Array<unknown>|TypedArray
Item to search.
Type: number
Relative index.
Tested in Chrome 72, Edge 15, Firefox 65 and should work in all modern browsers (support based on Browserslist configuration).
Test suite is taken and modified from following packages:
For automated tests, run npm run test:automated
(append :watch
for watcher
support).
MIT © Ivan Nikolić
FAQs
Array/string `.at()` ponyfill.
We found that array-string-at 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.