Requires
- module:path
- module:fs-extra
Members
getCurrentTimestamp
- Source:
Provides the current timestamp
Example
const rootRequire = require('rpcm-root-require');
const Utils = ('/platform-helpers/utils');
const actual = Utils.getCurrentTimestamp();
console.log(actual);
// logs: 123456789
getNewLine
- Source:
Provides a terminal new line (or multiple lines as per argument if provided)
Example
const rootRequire = require('rpcm-root-require');
const Utils = ('/platform-helpers/utils');
rootRequire('/platform-helpers/string-extensions');
const singleNewLine = 'The quick brown {0} jumps {1}{2} the {3} dog!'.format('fox', Utils.getNewLine(), 'over', 'lazy');
console.log(singleNewLine);
// logs:
// The quick brown fox jumps
// over the lazy dog!
const multipleNewLines = 'The quick brown {0} jumps {1}{2} the {3} dog!'.format('fox', Utils.getNewLine(2), 'over', 'lazy');
console.log(multipleNewLines);
// logs:
// The quick brown fox jumps
//
// over the lazy dog!
getRandomString
- Source:
Provides a random string
Example
const rootRequire = require('rpcm-root-require');
const Utils = ('/platform-helpers/utils');
const actual = Utils.getRandomString();
console.log(actual);
// logs: '123456789'
getRepeatedCharacters
- Source:
Provides a string of repeated characters
Example
const rootRequire = require('rpcm-root-require');
const Utils = ('/platform-helpers/utils');
rootRequire('/platform-helpers/string-extensions');
const singleSpace = 'The quick brown {0} jumps {1}{2} the {3} dog!'.format('fox', Utils.getRepeatedCharacters(), 'over', 'lazy');
console.log(singleSpace);
// logs: The quick brown fox jumps over the lazy dog!
const multipleSpaces = 'The quick brown {0} jumps {1}{2} the {3} dog!'.format('fox', Utils.getRepeatedCharacters(' ', 4), 'over', 'lazy');
console.log(multipleSpaces);
// logs: The quick brown fox jumps over the lazy dog!
sleep
- Source:
Stops processing for the provided amount of time
Example
const rootRequire = require('rpcm-root-require');
const Utils = ('/platform-helpers/utils');
console.log(new Date());
// logs: 2022-11-13T14:10:19.500Z
const actual = Utils.sleep(5000);
console.log(new Date());
// logs: 2022-11-13T14:15:19.500Z
wait
- Source:
Stops processing for the provided amount of time
Example
const rootRequire = require('rpcm-root-require');
const Utils = ('/platform-helpers/utils');
console.log(new Date());
// logs: 2022-11-13T14:10:19.500Z
const actual = Utils.wait(5000);
console.log(new Date());
// logs: 2022-11-13T14:15:19.500Z