# Generated by detroit
# See https://github.com/bourbonut/detroit/tree/main/api_maker

from functools import partial
from operator import is_not

class Adder:
    def __init__(self, content="Adder"):
        self.content = content

    def __repr__(self):
        return self.content

    def __str__(self):
        return self.content

    def __call__(self, *args):
        arguments = ", ".join(map(repr, args))
        return f"{self}({arguments})"

    def add(self, number=None):
        """
        .. code:: javascript

            adder.add(42)

        Adds the specified number to the adder’s current value and returns the adder.

        See more informations `here <https://d3js.org/d3-array/add#adder_add>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (number,))))
        return Adder(content=f"{self.content}.add({arguments})")


    def valueOf(self):
        """
        .. code:: javascript

            adder.valueOf() // 42

        Returns the IEEE 754 double-precision representation of the adder’s current value. Most
        useful as the short-hand notation +adder, or when coercing as Number(adder).

        See more informations `here <https://d3js.org/d3-array/add#adder_valueOf>`_.
        """
        return Adder(content=f"{self.content}.valueOf()")

