UNPKG

locutus

Version:

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

13 lines (12 loc) 499 B
import { pythonInvert } from "../_helpers/_operator.js"; export function invert(a) { // discuss at: https://locutus.io/python/operator/invert/ // parity verified: Python 3.12 // original by: Kevin van Zonneveld (https://kvz.io) // note 1: Performs Python-style bitwise inversion on integer-like values. // example 1: invert(5) // returns 1: -6 // example 2: invert(0) // returns 2: -1 return pythonInvert(a, 'invert'); }