UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

14 lines (13 loc) 419 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nchar = nchar; function nchar(x) { // discuss at: https://locutus.io/r/nchar/ // parity verified: R 4.4 // original by: Kevin van Zonneveld (https://kvz.io) // example 1: nchar('hello') // returns 1: 5 // example 2: nchar('') // returns 2: 0 return String(x).length; }