mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update strings.js
This commit is contained in:
parent
b3facdcaae
commit
c187fa43a0
6
helloworld.js
Normal file
6
helloworld.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
function main(args) {
|
||||
console.log("Hello world");
|
||||
console.log(typeof Intl);
|
||||
}
|
||||
|
||||
exports.main = main;
|
|
@ -2,7 +2,7 @@
|
|||
* strings.js
|
||||
*/
|
||||
|
||||
var number_format = function(number, decimals, decPoint, thousandsSep) { // eslint-disable-line camelcase
|
||||
function numberFormat(number, decimals, decPoint, thousandsSep) { // eslint-disable-line camelcase
|
||||
// discuss at: https://locutus.io/php/number_format/
|
||||
// original by: Jonas Raoni Soares Silva (https://www.jsfromhell.com)
|
||||
// improved by: Kevin van Zonneveld (https://kvz.io)
|
||||
|
@ -82,4 +82,27 @@ var number_format = function(number, decimals, decPoint, thousandsSep) { // esli
|
|||
return s.join(dec)
|
||||
}
|
||||
|
||||
exports.number_format = number_format;
|
||||
function splitLines(s) {
|
||||
return s.split(/\r?\n/);
|
||||
}
|
||||
|
||||
function selectLines(s, lineNumbers) {
|
||||
var selected_lines = [];
|
||||
var lines = splitLines(s);
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (lineNumbers.indexOf(i) > -1) {
|
||||
selected_lines.push(lines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return selected_lines;
|
||||
}
|
||||
|
||||
exports.numberFormat = numberFormat;
|
||||
exports.splitLines = splitLines;
|
||||
exports.selectLines = selectLines;
|
||||
|
||||
exports.VERSIONINFO = "Strings Library (strings.js) version 0.1.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user