
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
liamloads-count-characters
Advanced tools
This is a fast algorithm for measuring string length by counting characters instead of UTF-16 code units.
It's written in JavaScript and outputs the number
count of characters.
A complete line-by-line algorithm code explanation is coming soon.
git clone https://github.com/liamloads/javascript-count-characters.git
<script src="liamloads-count-characters.js" type="text/javascript"></script>
npm install liamloads-count-characters
const liamloadsCountCharacters = require('liamloads-count-characters');
The return value is a number
count of characters from the string
input.
If the argument isn't a string
or if the UTF-16 code unit length exceeds 999999999
, the return value is false
.
console.log(liamloadsCountCharacters('◯'));
// 1
console.log(liamloadsCountCharacters('◯◯'));
// 2
console.log(liamloadsCountCharacters('◯◯◯'));
// 3
console.log(liamloadsCountCharacters('◯◯◯◯'));
// 4
console.log(liamloadsCountCharacters('◯◯◯◯◯'));
// 5
console.log(liamloadsCountCharacters('◯◯◯◯◯◯'));
// 6
console.log(liamloadsCountCharacters('◯◯◯◯◯◯◯'));
// 7
console.log(liamloadsCountCharacters('◯◯◯◯◯◯◯◯'));
// 8
console.log(liamloadsCountCharacters('◯◯◯◯◯◯◯◯◯'));
// 9
console.log(liamloadsCountCharacters([123456789]));
// false
FAQs
Count string characters with JavaScript.
The npm package liamloads-count-characters receives a total of 0 weekly downloads. As such, liamloads-count-characters popularity was classified as not popular.
We found that liamloads-count-characters 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.