locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
13 lines (12 loc) • 477 B
JavaScript
import { pythonPos } from "../_helpers/_operator.js";
export function pos(a) {
// discuss at: https://locutus.io/python/operator/pos/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// note 1: Returns the Python-style unary positive of a numeric value.
// example 1: pos(-4)
// returns 1: -4
// example 2: pos(true)
// returns 2: 1
return pythonPos(a, 'pos');
}