text:
from .. import Availability, Class, Constant, Define, Method, Parameter, Type

gx_class = Class('MAP',
                 doc="""
                 MAPs are containers for :class:`MVIEW` objects. A view is a 3-D translation
                 and a clip window on a map. Graphic entities can be drawn in an :class:`MVIEW`.
                 It is recommended that the :class:`MAP` class be instantiated by first creating
                 an :class:`EMAP` object and calling the :func:`Lock_EMAP` function.
                 (See the explanation on the distinction between the :class:`MAP` and :class:`EMAP` classes).
                 """)

gx_defines = [
    Define('DUPMAP',
           doc="Duplicate Modes",
           constants=[
               Constant('DUPMAP_BLANK', value='0', type=Type.INT32_T,
                        doc="Blank"),
               Constant('DUPMAP_COPY', value='1', type=Type.INT32_T,
                        doc="Copy all current contents"),
               Constant('DUPMAP_COPY_PRE62', value='2', type=Type.INT32_T,
                        doc="Copy all current contents and save text for pre-6.2 versions.")
           ]),

    Define('MAP_EXPORT_BITS',
           doc="Color Types",
           constants=[
               Constant('MAP_EXPORT_BITS_32', value='32', type=Type.INT32_T,
                        doc="32 Bit Color (8-bit alpha)"),
               Constant('MAP_EXPORT_BITS_24', value='24', type=Type.INT32_T,
                        doc="24 Bit Color"),
               Constant('MAP_EXPORT_BITS_GREY8', value='9', type=Type.INT32_T,
                        doc="8 Bit Gray Scale"),
               Constant('MAP_EXPORT_BITS_8', value='8', type=Type.INT32_T,
                        doc="8 Bit Color"),
               Constant('MAP_EXPORT_BITS_GREY4', value='5', type=Type.INT32_T,
                        doc="4 Bit Gray Scale"),
               Constant('MAP_EXPORT_BITS_4', value='4', type=Type.INT32_T,
                        doc="4 Bit Color"),
               Constant('MAP_EXPORT_BITS_GREY1', value='1', type=Type.INT32_T,
                        doc="1 Bit Gray Scale"),
               Constant('MAP_EXPORT_BITS_DEFAULT', value='0', type=Type.INT32_T,
                        doc="Default Resolution")
           ]),

    Define('MAP_EXPORT_FORMAT',
           doc="""
           Export Formats
           Format   Description                  Type
           =======  ==========================   ====
           """,
           constants=[
               Constant('MAP_EXPORT_FORMAT_PLT', value='PLT', type=Type.STRING,
                        doc='"PLT"    Geosoft Plot (``*.plt``)         Plot'),
               Constant('MAP_EXPORT_FORMAT_SHP', value='SHP', type=Type.STRING,
                        doc='":class:`SHP`"    ArcView Shapfile (``*.shp``)     Plot'),
               Constant('MAP_EXPORT_FORMAT_DXF12', value='DXF12', type=Type.STRING,
                        doc='"DXF12"  AutoCad12 (``*.dxf``)            Plot'),
               Constant('MAP_EXPORT_FORMAT_DXF13', value='DXF13', type=Type.STRING,
                        doc='"DXF13"  AutoCad13 (``*.dxf``)            Plot'),
               Constant('MAP_EXPORT_FORMAT_GTIFF', value='GTIFF', type=Type.STRING,
                        doc='"GTIFF"  GeoTIFF (``*.tif``),             Color Image'),
               Constant('MAP_EXPORT_FORMAT_MTIFF', value='MTIFF', type=Type.STRING,
                        doc='"MTIFF"  MapInfo TIFF (``*.tif``)         Color Image'),
               Constant('MAP_EXPORT_FORMAT_ATIFF', value='ATIFF', type=Type.STRING,
                        doc='"ATIFF"  ArcView TIFF (``*.tif``)         Color Image'),
               Constant('MAP_EXPORT_FORMAT_GEO', value='GEO', type=Type.STRING,
                        doc='":class:`GEO`"    Geosoft COLOR grid (``*.grd``)   Color Image'),
               Constant('MAP_EXPORT_FORMAT_ERM', value='ERM', type=Type.STRING,
                        doc='"ERM"    ER Mapper RGB (``*.ers``)        Color Image'),
               Constant('MAP_EXPORT_FORMAT_KMZ', value='KMZ', type=Type.STRING,
                        doc='"KMZ"    Keyhole Markup (``*.kmz``)       Zipped XML/Image files')
           ]),

    Define('MAP_EXPORT_METHOD',
           doc="Dithering Methods",
           constants=[
               Constant('MAP_EXPORT_METHOD_STANDARD', value='0', type=Type.INT32_T,
                        doc="Standard Dither"),
               Constant('MAP_EXPORT_METHOD_DIFFUSE', value='1', type=Type.INT32_T,
                        doc="Error Diffusion Dither"),
               Constant('MAP_EXPORT_METHOD_NONE', value='2', type=Type.INT32_T,
                        doc="No Dither")
           ]),

    Define('MAP_EXPORT_RASTER_FORMAT',
           doc="""
           Export Raster Formats
           .
           Format  Description                      Type           B/W  B/W  COL  B/W  COL  COL
           ======= ==========================       ===========    ===  ===  ===  ===  ===  ===
           """,
           constants=[
               Constant('MAP_EXPORT_RASTER_FORMAT_EMF', value='EMF', type=Type.STRING,
                        doc='"EMF"   Enhanced Metafile (``*.emf``)        Plot'),
               Constant('MAP_EXPORT_RASTER_FORMAT_BMP', value='BMP', type=Type.STRING,
                        doc='"BMP"   Bitmap (``*.bmp``)                   Color Image     X    X    X    X    X    X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_JPEGL', value='JPEGL', type=Type.STRING,
                        doc='"JPEGL" JPEG Low Quality (``*.jpg``)         Color Image                              X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_JPEG', value='JPEG', type=Type.STRING,
                        doc='"JPEG" JPEG (``*.jpg``)                     Color Image                              X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_JPEGH', value='JPEGH', type=Type.STRING,
                        doc='"JPEGH" JPEG High Quality (``*.jpg``)        Color Image                              X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_GIF', value='GIF', type=Type.STRING,
                        doc='"GIF"   GIF (``*.gif``)                      Color Image     X    X    X    X    X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_PCX', value='PCX', type=Type.STRING,
                        doc='"PCX"   PCX (``*.pcx``)                      Color Image     X    X    X    X    X    X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_PNG', value='PNG', type=Type.STRING,
                        doc='"PNG"   PNG (``*.png``)                      Color Image     X    X    X    X    X    X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_EPS', value='EPS', type=Type.STRING,
                        doc='"EPS"   Encasulated PostScript (``*.eps``)   Color Image                    X'),
               Constant('MAP_EXPORT_RASTER_FORMAT_TIFF', value='TIFF', type=Type.STRING,
                        doc='"TIFF"  TIFF (``*.tif``)                     Color Image     X    X    X    X    X    X')
           ]),

    Define('MAP_LIST_MODE',
           doc="Map List modes",
           constants=[
               Constant('MAP_LIST_MODE_ALL', value='0', type=Type.INT32_T),
               Constant('MAP_LIST_MODE_3D', value='1', type=Type.INT32_T),
               Constant('MAP_LIST_MODE_NOT3D', value='2', type=Type.INT32_T)
           ]),

    Define('MAP_OPEN',
           doc="Open Modes",
           constants=[
               Constant('MAP_WRITENEW', value='1', type=Type.INT32_T),
               Constant('MAP_WRITEOLD', value='2', type=Type.INT32_T)
           ])]

gx_methods = {
    'Export': [

        Method('ExportAllInView_MAP', module='geoengine.map', version='7.1.0',
               availability=Availability.PUBLIC,
               doc="Export the entire map in view units to an external format. View and Group names are removed and plane spatial coordinates will be in the units of the map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('name', type=Type.STRING,
                             doc="File Name To Export"),
                   Parameter('view', type=Type.STRING,
                             doc="View to export coordinates in"),
                   Parameter('pix_size', type=Type.DOUBLE,
                             doc="Resolution in view units of one pixel (or dummy, will be used if DPI is dummy)"),
                   Parameter('dpi', type=Type.DOUBLE,
                             doc="Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)"),
                   Parameter('bits', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_BITS`"),
                   Parameter('dither', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_METHOD`"),
                   Parameter('format', type=Type.STRING,
                             doc=":def:`MAP_EXPORT_FORMAT`"),
                   Parameter('options', type=Type.STRING,
                             doc="Extended Options String (format specific)")
               ]),

        Method('ExportAllRaster_MAP', module='geoengine.map', version='7.1.0',
               availability=Availability.PUBLIC,
               doc="Export the entire map to map to a non-geo raster format.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('name', type=Type.STRING,
                             doc="File Name To Export"),
                   Parameter('view', type=Type.STRING,
                             doc="View to export coordinates in"),
                   Parameter('size_x', type=Type.INT32_T,
                             doc="Number of Pixels in X (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)"),
                   Parameter('size_y', type=Type.INT32_T,
                             doc="Number of Pixels in Y (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)"),
                   Parameter('dpi', type=Type.DOUBLE,
                             doc="Resolution in DPI (will override X and Y if not dummy, map page size will be used to determine pixel size of output)"),
                   Parameter('bits', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_BITS`"),
                   Parameter('dither', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_METHOD`"),
                   Parameter('format', type=Type.STRING,
                             doc=":def:`MAP_EXPORT_RASTER_FORMAT`"),
                   Parameter('options', type=Type.STRING,
                             doc="Extended Options String (format specific)")
               ]),

        Method('ExportAreaInView_MAP', module='geoengine.map', version='7.1.0',
               availability=Availability.PUBLIC,
               doc="Export an area of a map in view units to an external format",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('name', type=Type.STRING,
                             doc="File Name To Export"),
                   Parameter('view', type=Type.STRING,
                             doc="View to export coordinates in"),
                   Parameter('pix_size', type=Type.DOUBLE,
                             doc="Resolution in view units of one pixel (or dummy, will be used if DPI is dummy)"),
                   Parameter('dpi', type=Type.DOUBLE,
                             doc="Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)"),
                   Parameter('bits', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_BITS`"),
                   Parameter('dither', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_METHOD`"),
                   Parameter('min_x', type=Type.DOUBLE,
                             doc="Area To Export Min X location in view units"),
                   Parameter('min_y', type=Type.DOUBLE,
                             doc="Area To Export Min Y location in view units"),
                   Parameter('max_x', type=Type.DOUBLE,
                             doc="Area To Export Max X location in view units"),
                   Parameter('max_y', type=Type.DOUBLE,
                             doc="Area To Export Max Y location in view units"),
                   Parameter('format', type=Type.STRING,
                             doc=":def:`MAP_EXPORT_FORMAT`"),
                   Parameter('options', type=Type.STRING,
                             doc="Extended Options String (format specific)")
               ]),

        Method('ExportAreaRaster_MAP', module='geoengine.map', version='7.1.0',
               availability=Availability.PUBLIC,
               doc="Export an area of a map to a non-geo raster format.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('name', type=Type.STRING,
                             doc="File Name To Export"),
                   Parameter('view', type=Type.STRING,
                             doc="View to export coordinates in"),
                   Parameter('min_x', type=Type.DOUBLE,
                             doc="Area To Export Min X location in view units"),
                   Parameter('min_y', type=Type.DOUBLE,
                             doc="Area To Export Min Y location in view units"),
                   Parameter('max_x', type=Type.DOUBLE,
                             doc="Area To Export Max X location in view units"),
                   Parameter('max_y', type=Type.DOUBLE,
                             doc="Area To Export Max Y location in view units"),
                   Parameter('size_x', type=Type.INT32_T,
                             doc="Number of Pixels in X (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)"),
                   Parameter('size_y', type=Type.INT32_T,
                             doc="Number of Pixels in Y (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)"),
                   Parameter('dpi', type=Type.DOUBLE,
                             doc="Resolution in DPI (will override X and Y if not dummy, map page size will be used to determine pixel size of output)"),
                   Parameter('bits', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_BITS`"),
                   Parameter('dither', type=Type.INT32_T,
                             doc=":def:`MAP_EXPORT_METHOD`"),
                   Parameter('format', type=Type.STRING,
                             doc=":def:`MAP_EXPORT_RASTER_FORMAT`"),
                   Parameter('options', type=Type.STRING,
                             doc="Extended Options String (format specific)")
               ]),

        Method('RenderBitmap_MAP', module='geoengine.map', version='6.0.0',
               availability=Availability.PUBLIC,
               doc="Render a map to a bitmap.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('view', type=Type.STRING,
                             doc="View we exporting units in"),
                   Parameter('min_x', type=Type.DOUBLE,
                             doc="MinX"),
                   Parameter('min_y', type=Type.DOUBLE,
                             doc="MinY"),
                   Parameter('max_x', type=Type.DOUBLE,
                             doc="MaxX"),
                   Parameter('max_y', type=Type.DOUBLE,
                             doc="MaxY"),
                   Parameter('file', type=Type.STRING,
                             doc="File to generate (BMP or PNG, otherwise extension forced to BMP)"),
                   Parameter('max_res', type=Type.INT32_T,
                             doc="Maximum resolution in either direction, -1 for none (will change the pixel density of image if exceeded)")
               ]),

        Method('RenderViewBitmap_MAP', module='geoengine.map', version='9.6.0',
               availability=Availability.PUBLIC,
               doc="Render a map view to a bitmap.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('view', type="MVIEW",
                             doc=":class:`MVIEW` object"),
                   Parameter('group', type=Type.INT32_T,
                             doc="group (-1 for all)"),
						 Parameter('min_x', type=Type.DOUBLE,
                             doc="MinX"),
                   Parameter('min_y', type=Type.DOUBLE,
                             doc="MinY"),
                   Parameter('max_x', type=Type.DOUBLE,
                             doc="MaxX"),
                   Parameter('max_y', type=Type.DOUBLE,
                             doc="MaxY"),
                   Parameter('file', type=Type.STRING,
                             doc="File to generate (BMP or PNG, otherwise extension forced to BMP)"),
                   Parameter('max_res', type=Type.INT32_T,
                             doc="Maximum resolution in either direction, -1 for none (will change the pixel density of image if exceeded)")
               ])
    ],
    '3D View': [

        Method('CreateLinked3DView_MAP', module='geoengine.map', version='9.2.0',
               availability=Availability.PUBLIC,
               doc="Create a 3D View in this map that is linked to a :class:`MVIEW` in a 3D View file.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Object"),
                   Parameter('mview', type="MVIEW",
                             doc=":class:`3DV`'s 3D :class:`MVIEW`"),
                   Parameter('view_name', type=Type.STRING,
                             doc="New view name"),
                   Parameter('min_x', type=Type.DOUBLE,
                             doc="X minimum in mm"),
                   Parameter('min_y', type=Type.DOUBLE,
                             doc="Y minimun in mm"),
                   Parameter('max_x', type=Type.DOUBLE,
                             doc="X maximum in mm"),
                   Parameter('max_y', type=Type.DOUBLE,
                             doc="Y maximum in mm")
               ])
    ],
    'Miscellaneous': [

        Method('AGGList_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get a list of all aggregates in this map.",
               notes="""
               List items are returned as view/agg/layer.
               The layer name is optional
               """,
               see_also=":class:`LST` class.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('lst', type="LST",
                             doc="List to hold the views (allow up to 96 characters)"),
                   Parameter('optn', type=Type.INT32_T,
                             doc="0 - view/agg only 1 - view/agg/layer")
               ]),

        Method('AGGListEx_MAP', module='geoengine.map', version='5.1.2',
               availability=Availability.PUBLIC,
               doc="Get a list of aggregates in this map based on a mode",
               notes="""
               List items are returned as view/agg/layer.
               The layer name is optional
               """,
               see_also=":class:`LST` class.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('lst', type="LST",
                             doc="List to hold the views (allow up to 96 characters)"),
                   Parameter('optn', type=Type.INT32_T,
                             doc="0 - view/agg only 1 - view/agg/layer"),
                   Parameter('mode', type=Type.INT32_T,
                             doc=":def:`MAP_LIST_MODE`")
               ]),

        Method('Clean_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Clean up empty groups in all views in map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle")
               ]),

        Method('Commit_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Commit any changes to a map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc="Map")
               ]),

        Method('CopyMapToView_MAP', module='geoengine.map', version='5.1.8',
               availability=Availability.PUBLIC,
               doc="Copy entire map into one view in output map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc="Source :class:`MAP` object"),
                   Parameter('dest_map', type=Type.STRING,
                             doc="Destination :class:`MAP` name"),
                   Parameter('dest_view', type=Type.STRING,
                             doc="Name of View")
               ]),

        Method('CRCMap_MAP', module='geoengine.map', version='6.0.0',
               availability=Availability.PUBLIC,
               doc="Generate an XML CRC of a :class:`MAP`",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('crc', type=Type.INT32_T, is_ref=True,
                             doc="CRC returned"),
                   Parameter('file', type=Type.STRING,
                             doc="Name of xml to generate (.zip added)")
               ]),

        Method('Create_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Create a :class:`MAP`.",
               return_type="MAP",
               return_doc=":class:`MAP` Object",
               parameters = [
                   Parameter('name', type=Type.STRING,
                             doc=":class:`MAP` file name"),
                   Parameter('mode', type=Type.INT32_T,
                             doc=":def:`MAP_OPEN`")
               ]),

        Method('Current_MAP', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="This method returns the Current map opened.",
               notes="""
               If there is no current map, and running interactively,
               the user is prompted to open a map.
               """,
               return_type="MAP",
               return_doc=":class:`MAP` Object"),

        Method('DeleteView_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Deletes a view in this map.",
               notes="If the view does not exist, nothing happens.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('name', type=Type.STRING,
                             doc="View Name to delete")
               ]),

        Method('Destroy_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Destroy the :class:`MAP` handle.",
               notes="All changes to the map will be committed.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle")
               ]),

        Method('Discard_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Discard all changes made to the map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc="Map")
               ]),

        Method('DupMap_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Duplicate copy of current map.",
               notes="""
               Before version 6.2 text in maps were displayed with a character set
               defining how characters above ASCII 127 would be displayed. 6.2 introduced
               Unicode in the core montaj engine that eliminated the need for such a setting and
               greatly increased the number of symbols that can be used. The only caveat
               of the new system is that text may appear corrupted (especially with GFN fonts) in
               versions prior to 6.2 that render maps created in version 6.2 and later.
               The constant :const:`DUPMAP_COPY_PRE62` provides a way to create maps that can be
               distributed to versions prior to 6.2.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('ma_ps', type="MAP",
                             doc="Source :class:`MAP` object"),
                   Parameter('ma_pd', type="MAP",
                             doc="Destination :class:`MAP` object"),
                   Parameter('content', type=Type.INT32_T,
                             doc=":def:`DUPMAP`")
               ]),

        Method('GetLPT_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get the :class:`LPT` Object of a :class:`MAP`.",
               return_type="LPT",
               return_doc=":class:`LPT` Object",
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle")
               ]),

        Method('GetMapSize_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get the size of the Map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('xmin', type=Type.DOUBLE, is_ref=True,
                             doc="X minimum in mm"),
                   Parameter('ymin', type=Type.DOUBLE, is_ref=True,
                             doc="Y minimun in mm"),
                   Parameter('xmax', type=Type.DOUBLE, is_ref=True,
                             doc="X maximum in mm"),
                   Parameter('ymax', type=Type.DOUBLE, is_ref=True,
                             doc="Y maximum in mm")
               ]),

        Method('GetMETA_MAP', module='geoengine.map', version='5.1.8',
               availability=Availability.PUBLIC,
               doc="Get the map's :class:`META`",
               notes="If the map has no :class:`META`, an empty :class:`META` will be created.",
               return_type="META",
               return_doc=":class:`META` Object",
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object")
               ]),

        Method('GetREG_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get the map's :class:`REG`",
               notes="If the map has no :class:`REG`, an empty :class:`REG` will be created.",
               return_type="REG",
               return_doc=":class:`REG` Object",
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object")
               ]),

        Method('GroupList_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get a list of all views/groups in this map.",
               notes="""
               Returns all groups in the form "ViewName\\GroupName"
               To get a :class:`LST` of groups in a specific map view, use
               the :func:`iListGroups_MVIEW` function.
               """,
               see_also="""
               :class:`LST` class.
               :func:`iListGroups_MVIEW`
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('lst', type="LST",
                             doc="List to hold the view/groups.  Names may be up to 2080 characters in length.")
               ]),

        Method('GroupListEx_MAP', module='geoengine.map', version='5.1.2',
               availability=Availability.PUBLIC,
               doc="Get a list of views/groups in this map for this mode",
               see_also=":class:`LST` class.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('lst', type="LST",
                             doc="List to hold the views.  View names may be up to 2080 characters in length."),
                   Parameter('mode', type=Type.INT32_T,
                             doc=":def:`MAP_LIST_MODE`")
               ]),

        Method('IDuplicateView_MAP', module='geoengine.map', version='5.1.2',
               availability=Availability.PUBLIC,
               doc="Duplicate an entire view",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('view', type=Type.STRING,
                             doc="Name of view to duplicate"),
                   Parameter('n_view', type=Type.STRING, is_ref=True, size_of_param='size',
                             doc='Name of new view created (pass in "" and the new name is returned)'),
                   Parameter('size', type=Type.INT32_T, default_length='STR_VIEW',
                             doc="Length of view name buffer"),
                   Parameter('copy', type=Type.BOOL,
                             doc="Copy all groups")
               ]),

        Method('iExistView_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Checks to see if a view exists.",
               return_type=Type.INT32_T,
               return_doc="""
               0 view does not exist.
               1 view exists.
               """,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` handle"),
                   Parameter('name', type=Type.STRING,
                             doc="View name")
               ]),

        Method('IGetClassName_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get a class name.",
               notes="""
               Map class names are intended to be used to record the
               names of certain view classes in the map, such as the
               "Data", "Base" and "Section" views.

               There can only be one name for each class, but it can
               be changed.  This lets the "Data" class name change,
               for example, so plotting can select which class to plot
               to.

               If a name is not set, the class name is set and
               returned.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` handle"),
                   Parameter('cl', type=Type.STRING,
                             doc="Class"),
                   Parameter('name', type=Type.STRING, is_ref=True, size_of_param='length',
                             doc="Name"),
                   Parameter('length', type=Type.INT32_T, default_length='STR_DEFAULT',
                             doc="Maximum name length")
               ]),

        Method('IGetFileName_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get the name of the map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('name', type=Type.STRING, is_ref=True, size_of_param='length',
                             doc="Returned map file name"),
                   Parameter('length', type=Type.INT32_T, default_length='STR_FILE',
                             doc="Size of map name string")
               ]),

        Method('IGetMapName_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get the Map Name of the Map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('name', type=Type.STRING, is_ref=True, size_of_param='length',
                             doc="Returned map name"),
                   Parameter('length', type=Type.INT32_T, default_length='STR_FILE',
                             doc="Size of map name string")
               ]),

        Method('iPackedFiles_MAP', module='geoengine.map', version='6.4.0',
               availability=Availability.PUBLIC,
               doc="The number of packed files in the current map.",
               return_type=Type.INT32_T,
               return_doc="The number of packed files in map.",
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object")
               ]),

        Method('IUnPackFilesEx_MAP', module='geoengine.map', version='6.4.0',
               availability=Availability.PUBLIC,
               doc="UnPack all files from map to workspace.",
               notes="""
               The option to force will simply overwrite the files.
               When the non-force option is in effect the method will
               stop if any files are going to be overwritting. These
               file names will end up in the Errors string.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('force', type=Type.INT32_T,
                             doc="(0 - Produce errors, 1 - Force overwrites)"),
                   Parameter('errors', type=Type.STRING, is_ref=True, size_of_param='error_size',
                             doc="List of files that are problematic returned"),
                   Parameter('error_size', type=Type.INT32_T, default_length='STR_MULTI_FILE',
                             doc="Length of Error name buffer")
               ]),

        Method('IUnPackFilesToFolder_MAP', module='geoengine.map', version='7.3.0',
               availability=Availability.PUBLIC,
               doc="UnPack all files from map to workspace.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('force', type=Type.INT32_T,
                             doc="(0 - Produce errors, 1 - Force overwrites)"),
                   Parameter('dir', type=Type.STRING,
                             doc="Directory to place unpacked files in."),
                   Parameter('errors', type=Type.STRING, is_ref=True, size_of_param='error_size',
                             doc="List of files that are problematic returned"),
                   Parameter('error_size', type=Type.INT32_T, default_length='STR_MULTI_FILE',
                             doc="Length of Error name buffer")
               ]),

        Method('PackFiles_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Pack all files in the map so that it can be mailed.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object")
               ]),

        Method('Render_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Render a map to file/device.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('name', type=Type.STRING,
                             doc="Plot file/device")
               ]),

        Method('ResizeAll_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Resize a map to the extents of all views.",
               notes="""
               This is the same as :func:`ResizeAllEx_MAP` with
               :const:`MVIEW_EXTENT_CLIP`.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle")
               ]),

        Method('ResizeAllEx_MAP', module='geoengine.map', version='6.3.0',
               availability=Availability.PUBLIC,
               doc=":func:`ResizeAll_MAP` with selection of view extent type selection.",
               notes="""
               :const:`MVIEW_EXTENT_VISIBLE` gives a more "reasonable" map size, and won't
               clip off labels outside a graph window.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('ext', type=Type.INT32_T,
                             doc=":def:`MVIEW_EXTENT`")
               ]),

        Method('rGetMapScale_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get the current map scale",
               notes="""
               If there is a "Data" view, the scale is derived from
               this view.

               If their is no data view, the scale is derived
               from the first view that is not scaled in mm.
               otherwise, the scale is 1000 (mm).

               All views must be closed, or open read-only.
               """,
               return_type=Type.DOUBLE,
               return_doc="The current map scale",
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle")
               ]),

        Method('SaveAsMXD_MAP', module='geoengine.map', version='7.0.0',
               availability=Availability.LICENSED,
               doc="Save as ArcGIS :class:`MXD`",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('mxd', type=Type.STRING,
                             doc="Geosoft map file name")
               ]),

        Method('SetClassName_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Set a class name.",
               notes="""
               Map class names are intended to be used to record the
               names of certain view classes in the map, such as the
               "Data", "Base" and "Section" views.

               There can only be one name for each class, but it can
               be changed.  This lets the "Data" class name change,
               for example, so plotting can select which class to plot
               to.

               If a name is not set, the class name is set and
               returned.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` handle"),
                   Parameter('cl', type=Type.STRING,
                             doc="Class"),
                   Parameter('name', type=Type.STRING,
                             doc="Name")
               ]),

        Method('SetCurrent_MAP', module='None', version='5.0.0',
               availability=Availability.PUBLIC, is_app=True,
               doc="Sets the current map to this map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object")
               ]),

        Method('SetMapName_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Set the Map Name of the Map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('name', type=Type.STRING,
                             doc="Map Name")
               ]),

        Method('SetMapScale_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Set the current map scale",
               notes="""
               All views in the map will be resized for the new
               map scale.
               """,
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('scale', type=Type.DOUBLE,
                             doc="New map scale (must be > 0).")
               ]),

        Method('SetMapSize_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Set the size of the Map.",
               notes="""
               The map size is area on the :class:`MAP` that contains graphics
               to be plotted.  The area can be bigger or smaller that
               the current views.  In the absense of any other information
               only the area defined by the map size is plotted.
               """,
               see_also="SetSizeViews_MAP",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('xmin', type=Type.DOUBLE,
                             doc="X minimum in mm"),
                   Parameter('ymin', type=Type.DOUBLE,
                             doc="Y minimun in mm"),
                   Parameter('xmax', type=Type.DOUBLE,
                             doc="X maximum in mm"),
                   Parameter('ymax', type=Type.DOUBLE,
                             doc="Y maximum in mm")
               ]),

        Method('SetMETA_MAP', module='geoengine.map', version='5.1.8',
               availability=Availability.PUBLIC,
               doc="Write a :class:`META` to a map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('meta', type="META",
                             doc=":class:`META` to write to map")
               ]),

        Method('SetREG_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Write a :class:`REG` to a map.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object"),
                   Parameter('reg', type="REG",
                             doc=":class:`REG` to write to map")
               ]),

        Method('Sync_MAP', module='geoengine.map', version='7.0.0',
               availability=Availability.LICENSED,
               doc="Syncronize the Metadata",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type=Type.STRING,
                             doc="Geosoft map file name")
               ]),

        Method('UnPackFiles_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="UnPack all files from map to workspace.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` object")
               ]),

        Method('ViewList_MAP', module='geoengine.map', version='5.0.0',
               availability=Availability.PUBLIC,
               doc="Get a list of all views in this map.",
               see_also=":class:`LST` class.",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('lst', type="LST",
                             doc="List to hold the views.  View names may be up to 2080 characters in length.")
               ]),

        Method('ViewListEx_MAP', module='geoengine.map', version='5.1.2',
               availability=Availability.PUBLIC,
               doc="Get a list of views of certain types in this map",
               return_type=Type.VOID,
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle"),
                   Parameter('lst', type="LST",
                             doc="List to hold the views.  View names may be up to 2080 characters in length."),
                   Parameter('mode', type=Type.INT32_T,
                             doc=":def:`MAP_LIST_MODE`")
               ]),

        Method('GetDataProj_MAP', module='geoengine.map', version='8.3.0',
               availability=Availability.PUBLIC,
               doc="Get the projection type of the Data view of a map.",
               return_type=Type.INT32_T,
               return_doc="Project type as an integer",
               parameters = [
                   Parameter('map', type="MAP",
                             doc=":class:`MAP` Handle")
               ])
    ]
}


text:
let hiding = false

export function hideLoader() {
  if (hiding) return
  const loader = window.document.getElementById('loader')
  if (!loader) return
  hiding = true
  const onTransitionEnd = () => {
    loader.style.display = 'none'
    loader.removeEventListener('transitionend', onTransitionEnd)
  }

  loader.addEventListener('transitionend', onTransitionEnd, false)
  loader.style.opacity = 0
}

redpajama_set_name: RedPajamaGithub


text:
//=============================================================================//
//  ___  ___   _   _   _    __   _   ___ ___ __ __
// |_ _|| __| / \ | \_/ |  / _| / \ | o \ o \\ V /
//  | | | _| | o || \_/ | ( |_n| o ||   /   / \ /
//  |_| |___||_n_||_| |_|  \__/|_n_||_|\\_|\\ |_|  2007
//
//=============================================================================//
-- Edited for FAdmin by FPtje. Original credits to team Garry.
local PANEL = {}

/*---------------------------------------------------------
	Init
---------------------------------------------------------*/
function PANEL:Init()

	self:SetMouseInputEnabled( true );
	self:SetKeyboardInputEnabled( true );

	self:SetDeleteOnClose( false );

	self:SetTitle("Change level");

	self:CreateControls();

end

/*---------------------------------------------------------
	CreateControls
---------------------------------------------------------*/
function PANEL:CreateControls()

	self.StartGame = vgui.Create("FAdmin_StartGame", self );
	self.MapSheet = vgui.Create("DPropertySheet", self );

	self.MapIcons = vgui.Create("MapListIcons");
	self.MapIcons:SetController( self.StartGame );
	self.MapIcons:Setup();

	local Options = vgui.Create("FAdmin_MapListOptions", self );
	Options.Controller = self.StartGame
	Options:SetupSinglePlayer();

	self.MapSheet:AddSheet("Icons", self.MapIcons, "icon16/application_view_tile.png");
	self.MapSheet:AddSheet("Options", Options, "icon16/application_view_detail.png");

end

/*---------------------------------------------------------
	PerformLayout
---------------------------------------------------------*/
function PANEL:PerformLayout()

	self:SetSize( 450, ScrH() * 0.8 );

	self.MapSheet:SetPos( 8, 25 );
	self.MapSheet:SetSize( self:GetWide() - 16, self:GetTall() - 25 - 8 - 60 - 8 );
	self.MapSheet:InvalidateLayout();

	self.StartGame:SetPos( 8, self:GetTall() - 60 - 8 );
	self.StartGame:SetSize( self:GetWide() - 16, 60 );

	self.BaseClass.PerformLayout( self );

end

function PANEL:RebuildFavourites()

	self.MapIcons:RebuildFavourites();

end

vgui.Register("FAdmin_Changelevel", PANEL, "DFrame")


text:
import React from 'react';
import ReactDOM from 'react-dom';

// Import styles like this:
import './styles/app.scss';

// Import dependencies like this:
import Deck from './components/deck';

class App extends React.Component {
  render() {
    return (
      <Deck />
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));


text:
<?php

namespace SMW\Tests\MediaWiki;

use SMW\Tests\Utils\Mock\MockTitle;
use SMW\MediaWiki\PageInfoProvider;

/**
 * @covers \SMW\MediaWiki\PageInfoProvider
 * @group semantic-mediawiki
 *
 * @license GNU GPL v2+
 * @since 1.9
 *
 * @author mwjames
 */
class PageInfoProviderTest extends \PHPUnit_Framework_TestCase {

	public function testCanConstruct() {

		$wikipage = $this->getMockBuilder( '\WikiPage' )
			->disableOriginalConstructor()
			->getMock();

		$this->assertInstanceOf(
			'\SMW\MediaWiki\PageInfoProvider',
			new PageInfoProvider( $wikipage )
		);
	}

	public function testWikiPage_TYPE_MODIFICATION_DATE() {

		$instance = $this->constructPageInfoProviderInstance(
			array(
				'wikiPage' => array( 'getTimestamp' => 1272508903 ),
				'revision' => array(),
				'user'     => array(),
			)
		);

		$this->assertEquals( 1272508903, $instance->getModificationDate() );
	}

	public function testWikiPage_TYPE_CREATION_DATE() {

		$revision = $this->getMockBuilder( '\Revision' )
			->disableOriginalConstructor()
			->getMock();

		$revision->expects( $this->any() )
			->method(  'getTimestamp' )
			->will( $this->returnValue( 1272508903 ) );

		$title = MockTitle::buildMock( 'Lula' );

		$title->expects( $this->any() )
			->method(  'getFirstRevision' )
			->will( $this->returnValue( $revision ) );

		$instance = $this->constructPageInfoProviderInstance(
			array(
				'wikiPage' => array( 'getTitle' => $title ),
				'revision' => array(),
				'user'     => array(),
			)
		);

		$this->assertEquals( 1272508903, $instance->getCreationDate() );
	}

	/**
	 * @dataProvider parentIdProvider
	 */
	public function testWikiPage_TYPE_NEW_PAGE_ForRevision( $parentId, $expected ) {

		$instance = $this->constructPageInfoProviderInstance(
			array(
				'wikiPage' => array(),
				'revision' => array( 'getParentId' => $parentId ),
				'user'     => array(),
			)
		);

		$this->assertEquals( $expected, $instance->isNewPage() );
	}

	/**
	 * @dataProvider parentIdProvider
	 */
	public function testWikiPage_TYPE_NEW_PAGE( $parentId, $expected ) {

		$revision = $this->getMockBuilder( '\Revision' )
			->disableOriginalConstructor()
			->getMock();

		$revision->expects( $this->any() )
			->method(  'getParentId' )
			->will( $this->returnValue( $parentId ) );

		$instance = $this->constructPageInfoProviderInstance(
			array(
				'wikiPage' => array( 'getRevision' => $revision ),
				'revision' => array( ),
				'user'     => array(),
			)
		);

		$this->assertEquals( $expected, $instance->isNewPage() );
	}

	public function parentIdProvider() {

		$provider = array(
			array( 90001, false ),
			array( null , true )
		);

		return $provider;
	}

	public function testWikiPage_TYPE_LAST_EDITOR() {

		$userPage = MockTitle::buildMock( 'Lula' );

		$userPage->expects( $this->any() )
			->method(  'getNamespace' )
			->will( $this->returnValue( NS_USER ) );

		$instance = $this->constructPageInfoProviderInstance(
			array(
				'wikiPage' => array(),
				'revision' => array(),
				'user'     => array( 'getUserPage' => $userPage ),
			)
		);

		$this->assertEquals( $userPage, $instance->getLastEditor() );
	}

	public function constructPageInfoProviderInstance( array $parameters ) {

		$wikiPage = $this->getMockBuilder( '\WikiPage' )
			->disableOriginalConstructor()
			->getMock();

		foreach ( $parameters['wikiPage'] as $method => $returnValue ) {
			$wikiPage->expects( $this->any() )
				->method(  $method  )
				->will( $this->returnValue( $returnValue ) );
		}

		$revision = $this->getMockBuilder( '\Revision' )
			->disableOriginalConstructor()
			->getMock();

		foreach ( $parameters['revision'] as $method => $returnValue ) {
			$revision->expects( $this->any() )
				->method(  $method  )
				->will( $this->returnValue( $returnValue ) );
		}

		$user = $this->getMockBuilder( '\User' )
			->disableOriginalConstructor()
			->getMock();

		foreach ( $parameters['user'] as $method => $returnValue ) {
			$user->expects( $this->any() )
				->method(  $method  )
				->will( $this->returnValue( $returnValue ) );
		}

		return new PageInfoProvider(
			$wikiPage,
			( $parameters['revision'] !== array() ? $revision : null ),
			( $parameters['user'] !== array() ? $user : null )
		);
	}

	/**
	 * @dataProvider uploadStatusWikiFilePageDataProvider
	 */
	public function testWikiFilePage_TYPE_NEW_PAGE( $uploadStatus, $expected ) {

		$wikiFilePage = $this->getMockBuilder( '\WikiFilePage' )
			->disableOriginalConstructor()
			->getMock();

		if ( $uploadStatus !== null ) {
			$wikiFilePage->smwFileReUploadStatus = $uploadStatus;
		}

		$instance = new PageInfoProvider( $wikiFilePage );

		$this->assertEquals( $expected, $instance->isNewPage() );
	}

	/**
	 * @dataProvider mediaTypeWikiFilePageDataProvider
	 */
	public function testWikiFilePage_MEDIA_TYPE( $file, $expected ) {

		$wikiFilePage = $this->getMockBuilder( '\WikiFilePage' )
			->disableOriginalConstructor()
			->getMock();

		$wikiFilePage->expects( $this->any() )
			->method( 'isFilePage' )
			->will( $this->returnValue( true ) );

		$wikiFilePage->expects( $this->any() )
			->method( 'getFile' )
			->will( $this->returnValue( $file ) );

		$instance = new PageInfoProvider( $wikiFilePage );

		$this->assertEquals( $expected, $instance->getMediaType() );
	}

	/**
	 * @dataProvider mimeTypeWikiFilePageDataProvider
	 */
	public function testWikiFilePage_MIME_TYPE( $file, $expected ) {

		$wikiFilePage = $this->getMockBuilder( '\WikiFilePage' )
			->disableOriginalConstructor()
			->getMock();

		$wikiFilePage->expects( $this->any() )
			->method( 'isFilePage' )
			->will( $this->returnValue( true ) );

		$wikiFilePage->expects( $this->any() )
			->method( 'getFile' )
			->will( $this->returnValue( $file ) );

		$instance = new PageInfoProvider( $wikiFilePage );

		$this->assertEquals( $expected, $instance->getMimeType() );
	}

	public function testWikiPage_MEDIA_TYPE() {

		$wikiFilePage = $this->getMockBuilder( '\WikiPage' )
			->disableOriginalConstructor()
			->getMock();

		$instance = new PageInfoProvider( $wikiFilePage );

		$this->assertEquals( null, $instance->getMediaType() );
	}

	public function testWikiPage_MIME_TYPE() {

		$wikiFilePage = $this->getMockBuilder( '\WikiPage' )
			->disableOriginalConstructor()
			->getMock();

		$instance = new PageInfoProvider( $wikiFilePage );

		$this->assertEquals( null, $instance->getMimeType() );
	}

	public function uploadStatusWikiFilePageDataProvider() {

		$provider = array(
			array( null, false ),
			array( false, true ),
			array( true , false )
		);

		return $provider;
	}

	public function mediaTypeWikiFilePageDataProvider() {

		$fileWithMedia = $this->getMockBuilder( '\File' )
			->disableOriginalConstructor()
			->getMock();

		$fileWithMedia->expects( $this->any() )
			->method( 'getMediaType' )
			->will( $this->returnValue( 'FooMedia' ) );

		$fileNullMedia = $this->getMockBuilder( '\File' )
			->disableOriginalConstructor()
			->getMock();

		$fileNullMedia->expects( $this->any() )
			->method( 'getMediaType' )
			->will( $this->returnValue( null ) );

		$provider[] = array( $fileWithMedia, 'FooMedia' );
		$provider[] = array( $fileNullMedia, null );

		return $provider;
	}

	public function mimeTypeWikiFilePageDataProvider() {

		$fileWithMime = $this->getMockBuilder( '\File' )
			->disableOriginalConstructor()
			->getMock();

		$fileWithMime->expects( $this->any() )
			->method( 'getMimeType' )
			->will( $this->returnValue( 'FooMime' ) );

		$fileNullMime = $this->getMockBuilder( '\File' )
			->disableOriginalConstructor()
			->getMock();

		$fileNullMime->expects( $this->any() )
			->method( 'getMediaType' )
			->will( $this->returnValue( null ) );

		$provider[] = array( $fileWithMime, 'FooMime' );
		$provider[] = array( $fileNullMime, null );

		return $provider;
	}

}


text:
* Visualize matched chars, search within fields

## 0.3.0 - Add Configuration Options
* added some configuration options to filter mnemonics to speed up atom commands by
  reducing them to needed

## 0.2.1 - Add Mnemonics Selection
* changed configuration names to "mnemonic" instead of "digraph" to have consistent naming

## 0.2.0 - Add digraph support
* You can now enable digraph support, which enables you to e.g hit
  `ctrl-k a :` to get a "ä" character.

## 0.1.0 - First Release
* Open a SelectListView to select characters from Unicode table


text:
![Logo](new-moon-logo.svg)

# New Moon for [Chrome DevTools](https://chrome.google.com/webstore/detail/devtools-theme-new-moon/lndddploiofhfpdcoclegenegblkhlfk?hl=en)

The optimized dark theme for web development.

![Screenshot](screenshot.png)

## Installation

- Navigate to `chrome://flags`, find **Developer Tools Experiments** and toggle to **Enabled**.
- Reload Chrome.
- In DevTools, click the three dots menu, go to **Settings -> Experiments** and select **Allow UI Themes**.
- Set theme to **Dark Mode** (this is important, or the theme won't look right).
- Load a new tab and enjoy your awesome new DevTools theme!

## Author

- [Tania Rascia](https://www.taniarascia.com)

## License

This project is open source and available under the [MIT License](LICENSE).


text:
find_program(NVPRUNE NAMES nvprune)

# The following macro uses a macro defined by
# FindCUDA module from cmake.
function(af_find_static_cuda_libs libname)
  cmake_parse_arguments(fscl "PRUNE" "" "" ${ARGN})

  set(search_name
    "${CMAKE_STATIC_LIBRARY_PREFIX}${libname}${CMAKE_STATIC_LIBRARY_SUFFIX}")
  cuda_find_library_local_first(CUDA_${libname}_LIBRARY
    ${search_name} "${libname} static library")

  if(fscl_PRUNE AND AF_WITH_PRUNE_STATIC_CUDA_NUMERIC_LIBS)
    get_filename_component(af_${libname} ${CUDA_${libname}_LIBRARY} NAME)

    set(liboutput ${CMAKE_CURRENT_BINARY_DIR}/${af_${libname}})
    add_custom_command(OUTPUT ${liboutput}.depend
      COMMAND ${NVPRUNE} ${cuda_architecture_flags} ${CUDA_${libname}_LIBRARY} -o ${liboutput}
      COMMAND ${CMAKE_COMMAND} -E touch ${liboutput}.depend
      BYPRODUCTS ${liboutput}
      MAIN_DEPENDENCY ${CUDA_${libname}_LIBRARY}
      COMMENT "Pruning ${CUDA_${libname}_LIBRARY} for ${cuda_build_targets}"
      VERBATIM)
    add_custom_target(prune_${libname}
      DEPENDS ${liboutput}.depend)
    set(cuda_pruned_library_targets ${cuda_pruned_library_targets};prune_${libname} PARENT_SCOPE)

    set(AF_CUDA_${libname}_LIBRARY "${liboutput}" PARENT_SCOPE)
  else()
    set(AF_CUDA_${libname}_LIBRARY ${CUDA_${libname}_LIBRARY} PARENT_SCOPE)
  endif()
  mark_as_advanced(CUDA_${libname}_LIBRARY)
endfunction()

## Copied from FindCUDA.cmake
## The target_link_library needs to link with the cuda libraries using
## PRIVATE
function(cuda_add_library cuda_target)
  cuda_add_cuda_include_once()

  # Separate the sources from the options
  cuda_get_sources_and_options(_sources _cmake_options _options ${ARGN})
  cuda_build_shared_library(_cuda_shared_flag ${ARGN})
  # Create custom commands and targets for each file.
  cuda_wrap_srcs( ${cuda_target} OBJ _generated_files ${_sources}
    ${_cmake_options} ${_cuda_shared_flag}
    OPTIONS ${_options} )

  # Compute the file name of the intermedate link file used for separable
  # compilation.
  cuda_compute_separable_compilation_object_file_name(link_file ${cuda_target} "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")

  # Add the library.
  add_library(${cuda_target} ${_cmake_options}
    ${_generated_files}
    ${_sources}
    ${link_file}
    )

  # Add a link phase for the separable compilation if it has been enabled.  If
  # it has been enabled then the ${cuda_target}_SEPARABLE_COMPILATION_OBJECTS
  # variable will have been defined.
  cuda_link_separable_compilation_objects("${link_file}" ${cuda_target} "${_options}" "${${cuda_target}_SEPARABLE_COMPILATION_OBJECTS}")

  target_link_libraries(${cuda_target}
      PRIVATE ${CUDA_LIBRARIES}
    )

  # We need to set the linker language based on what the expected generated file
  # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
  set_target_properties(${cuda_target}
    PROPERTIES
    LINKER_LANGUAGE ${CUDA_C_OR_CXX}
    POSITION_INDEPENDENT_CODE ON
  )
endfunction()


text:
using System;
using System.Collections.Generic;
using ServiceStack.Data;
using ServiceStack.Model;

namespace ServiceStack.Redis.Generic
{
    public interface IRedisTypedClient<T>
        : IEntityStore<T>
    {
        IHasNamed<IRedisList<T>> Lists { get; set; }
        IHasNamed<IRedisSet<T>> Sets { get; set; }
        IHasNamed<IRedisSortedSet<T>> SortedSets { get; set; }
        IRedisHash<TKey, T> GetHash<TKey>(string hashId);

        IRedisTypedTransaction<T> CreateTransaction();
        IRedisTypedPipeline<T> CreatePipeline();

        IRedisClient RedisClient { get; }

        IDisposable AcquireLock();
        IDisposable AcquireLock(TimeSpan timeOut);

        long Db { get; set; }
        List<string> GetAllKeys();
        IRedisSet TypeIdsSet { get; }

        T this[string key] { get; set; }

        string UrnKey(T value);

        string SequenceKey { get; set; }
        void SetSequence(int value);
        long GetNextSequence();
        long GetNextSequence(int incrBy);
        RedisKeyType GetEntryType(string key);
        string GetRandomKey();

        void SetValue(string key, T entity);
        void SetValue(string key, T entity, TimeSpan expireIn);
        bool SetValueIfNotExists(string key, T entity);
        bool SetValueIfExists(string key, T entity);

        T Store(T entity, TimeSpan expireIn);

        T GetValue(string key);
        T GetAndSetValue(string key, T value);
        bool ContainsKey(string key);
        bool RemoveEntry(string key);
        bool RemoveEntry(params string[] args);
        bool RemoveEntry(params IHasStringId[] entities);
        long IncrementValue(string key);
        long IncrementValueBy(string key, int count);
        long DecrementValue(string key);
        long DecrementValueBy(string key, int count);

        bool ExpireIn(object id, TimeSpan expiresAt);
        bool ExpireAt(object id, DateTime dateTime);
        bool ExpireEntryIn(string key, TimeSpan expiresAt);
        bool ExpireEntryAt(string key, DateTime dateTime);

        TimeSpan GetTimeToLive(string key);
        void Save();
        void SaveAsync();
        void FlushDb();
        void FlushAll();
        T[] SearchKeys(string pattern);
        List<T> GetValues(List<string> keys);
        List<T> GetSortedEntryValues(IRedisSet<T> fromSet, int startingFrom, int endingAt);

        void StoreAsHash(T entity);
        T GetFromHash(object id);

        //Set operations
        HashSet<T> GetAllItemsFromSet(IRedisSet<T> fromSet);
        void AddItemToSet(IRedisSet<T> toSet, T item);
        void RemoveItemFromSet(IRedisSet<T> fromSet, T item);
        T PopItemFromSet(IRedisSet<T> fromSet);
        void MoveBetweenSets(IRedisSet<T> fromSet, IRedisSet<T> toSet, T item);
        long GetSetCount(IRedisSet<T> set);
        bool SetContainsItem(IRedisSet<T> set, T item);
        HashSet<T> GetIntersectFromSets(params IRedisSet<T>[] sets);
        void StoreIntersectFromSets(IRedisSet<T> intoSet, params IRedisSet<T>[] sets);
        HashSet<T> GetUnionFromSets(params IRedisSet<T>[] sets);
        void StoreUnionFromSets(IRedisSet<T> intoSet, params IRedisSet<T>[] sets);
        HashSet<T> GetDifferencesFromSet(IRedisSet<T> fromSet, params IRedisSet<T>[] withSets);
        void StoreDifferencesFromSet(IRedisSet<T> intoSet, IRedisSet<T> fromSet, params IRedisSet<T>[] withSets);
        T GetRandomItemFromSet(IRedisSet<T> fromSet);

        //List operations
        List<T> GetAllItemsFromList(IRedisList<T> fromList);
        List<T> GetRangeFromList(IRedisList<T> fromList, int startingFrom, int endingAt);
        List<T> SortList(IRedisList<T> fromList, int startingFrom, int endingAt);
        void AddItemToList(IRedisList<T> fromList, T value);
        void PrependItemToList(IRedisList<T> fromList, T value);
        T RemoveStartFromList(IRedisList<T> fromList);
        T BlockingRemoveStartFromList(IRedisList<T> fromList, TimeSpan? timeOut);
        T RemoveEndFromList(IRedisList<T> fromList);
        void RemoveAllFromList(IRedisList<T> fromList);
        void TrimList(IRedisList<T> fromList, int keepStartingFrom, int keepEndingAt);
        long RemoveItemFromList(IRedisList<T> fromList, T value);
        long RemoveItemFromList(IRedisList<T> fromList, T value, int noOfMatches);
        long GetListCount(IRedisList<T> fromList);
        T GetItemFromList(IRedisList<T> fromList, int listIndex);
        void SetItemInList(IRedisList<T> toList, int listIndex, T value);
        void InsertBeforeItemInList(IRedisList<T> toList, T pivot, T value);
        void InsertAfterItemInList(IRedisList<T> toList, T pivot, T value);

        //Queue operations
        void EnqueueItemOnList(IRedisList<T> fromList, T item);
        T DequeueItemFromList(IRedisList<T> fromList);
        T BlockingDequeueItemFromList(IRedisList<T> fromList, TimeSpan? timeOut);

        //Stack operations
        void PushItemToList(IRedisList<T> fromList, T item);
        T PopItemFromList(IRedisList<T> fromList);
        T BlockingPopItemFromList(IRedisList<T> fromList, TimeSpan? timeOut);
        T PopAndPushItemBetweenLists(IRedisList<T> fromList, IRedisList<T> toList);
        T BlockingPopAndPushItemBetweenLists(IRedisList<T> fromList, IRedisList<T> toList, TimeSpan? timeOut);

        //Sorted Set operations
        void AddItemToSortedSet(IRedisSortedSet<T> toSet, T value);
        void AddItemToSortedSet(IRedisSortedSet<T> toSet, T value, double score);
        bool RemoveItemFromSortedSet(IRedisSortedSet<T> fromSet, T value);
        T PopItemWithLowestScoreFromSortedSet(IRedisSortedSet<T> fromSet);
        T PopItemWithHighestScoreFromSortedSet(IRedisSortedSet<T> fromSet);
        bool SortedSetContainsItem(IRedisSortedSet<T> set, T value);
        double IncrementItemInSortedSet(IRedisSortedSet<T> set, T value, double incrementBy);
        long GetItemIndexInSortedSet(IRedisSortedSet<T> set, T value);
        long GetItemIndexInSortedSetDesc(IRedisSortedSet<T> set, T value);
        List<T> GetAllItemsFromSortedSet(IRedisSortedSet<T> set);
        List<T> GetAllItemsFromSortedSetDesc(IRedisSortedSet<T> set);
        List<T> GetRangeFromSortedSet(IRedisSortedSet<T> set, int fromRank, int toRank);
        List<T> GetRangeFromSortedSetDesc(IRedisSortedSet<T> set, int fromRank, int toRank);
        IDictionary<T, double> GetAllWithScoresFromSortedSet(IRedisSortedSet<T> set);
        IDictionary<T, double> GetRangeWithScoresFromSortedSet(IRedisSortedSet<T> set, int fromRank, int toRank);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetDesc(IRedisSortedSet<T> set, int fromRank, int toRank);
        List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
        List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
        List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
        List<T> GetRangeFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByLowestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
        List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
        List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
        List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
        List<T> GetRangeFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, string fromStringScore, string toStringScore, int? skip, int? take);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore);
        IDictionary<T, double> GetRangeWithScoresFromSortedSetByHighestScore(IRedisSortedSet<T> set, double fromScore, double toScore, int? skip, int? take);
        long RemoveRangeFromSortedSet(IRedisSortedSet<T> set, int minRank, int maxRank);
        long RemoveRangeFromSortedSetByScore(IRedisSortedSet<T> set, double fromScore, double toScore);
        long GetSortedSetCount(IRedisSortedSet<T> set);
        double GetItemScoreInSortedSet(IRedisSortedSet<T> set, T value);
        long StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds);
        long StoreIntersectFromSortedSets(IRedisSortedSet<T> intoSetId, IRedisSortedSet<T>[] setIds, string[] args);
        long StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, params IRedisSortedSet<T>[] setIds);
        long StoreUnionFromSortedSets(IRedisSortedSet<T> intoSetId, IRedisSortedSet<T>[] setIds, string[] args);

        //Hash operations
        bool HashContainsEntry<TKey>(IRedisHash<TKey, T> hash, TKey key);
        bool SetEntryInHash<TKey>(IRedisHash<TKey, T> hash, TKey key, T value);
        bool SetEntryInHashIfNotExists<TKey>(IRedisHash<TKey, T> hash, TKey key, T value);
        void SetRangeInHash<TKey>(IRedisHash<TKey, T> hash, IEnumerable<KeyValuePair<TKey, T>> keyValuePairs);
        T GetValueFromHash<TKey>(IRedisHash<TKey, T> hash, TKey key);
        bool RemoveEntryFromHash<TKey>(IRedisHash<TKey, T> hash, TKey key);
        long GetHashCount<TKey>(IRedisHash<TKey, T> hash);
        List<TKey> GetHashKeys<TKey>(IRedisHash<TKey, T> hash);
        List<T> GetHashValues<TKey>(IRedisHash<TKey, T> hash);
        Dictionary<TKey, T> GetAllEntriesFromHash<TKey>(IRedisHash<TKey, T> hash);

        //Useful common app-logic
        void StoreRelatedEntities<TChild>(object parentId, List<TChild> children);
        void StoreRelatedEntities<TChild>(object parentId, params TChild[] children);
        void DeleteRelatedEntities<TChild>(object parentId);
        void DeleteRelatedEntity<TChild>(object parentId, object childId);
        List<TChild> GetRelatedEntities<TChild>(object parentId);
        long GetRelatedEntitiesCount<TChild>(object parentId);
        void AddToRecentsList(T value);
        List<T> GetLatestFromRecentsList(int skip, int take);
        List<T> GetEarliestFromRecentsList(int skip, int take);
    }

}


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.components.browser_ui.site_settings;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;

import org.chromium.components.content_settings.ContentSettingsType;
import org.chromium.components.location.LocationUtils;
import org.chromium.content_public.browser.BrowserContextHandle;

/**
 * A class for dealing with the Geolocation category.
 */
public class LocationCategory extends SiteSettingsCategory {
    public LocationCategory(BrowserContextHandle browserContextHandle) {
        super(browserContextHandle, SiteSettingsCategory.Type.DEVICE_LOCATION,
                android.Manifest.permission.ACCESS_COARSE_LOCATION);
    }

    @Override
    protected boolean enabledGlobally() {
        return LocationUtils.getInstance().isSystemLocationSettingEnabled();
    }

    @Override
    public boolean showPermissionBlockedMessage(Context context) {
        if (enabledForChrome(context) && enabledGlobally()) {
            return false;
        }

        // The only time we don't want to show location as blocked in system is when Chrome also
        // blocks Location by policy (because then turning it on in the system isn't going to
        // turn on location in Chrome).
        return WebsitePreferenceBridge.isContentSettingEnabled(
                       getBrowserContextHandle(), ContentSettingsType.GEOLOCATION)
                || WebsitePreferenceBridge.isContentSettingUserModifiable(
                        getBrowserContextHandle(), ContentSettingsType.GEOLOCATION);
    }

    @Override
    protected Intent getIntentToEnableOsGlobalPermission(Context context) {
        if (enabledGlobally()) return null;
        return LocationUtils.getInstance().getSystemLocationSettingsIntent();
    }

    @Override
    protected String getMessageForEnablingOsGlobalPermission(Context context) {
        Resources resources = context.getResources();
        if (enabledForChrome(context)) {
            return resources.getString(R.string.android_location_off_globally);
        }
        return resources.getString(R.string.android_location_also_off_globally);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LionFire.Trading
{

    public class LiveDataSource : IDataSource
    {
        public string SourceName { get; set; }
        public string Account { get; set; }
        public string Broker { get; set; }
        public bool IsDemo { get; set; }

        public MarketSeries GetMarketSeries(string symbol, TimeFrame timeFrame)
        {
            throw new NotImplementedException();
        }

        public MarketSeries GetMarketSeries(string key)
        {
            throw new NotImplementedException();
        }

        public MarketSeries GetMarketSeries(string symbol, TimeFrame timeFrame, DateTime? startDate = default(DateTime?), DateTime? endDate = default(DateTime?))
        {
            throw new NotImplementedException();
        }

        public MarketSeries GetMarketSeries(string key, DateTime? startDate = default(DateTime?), DateTime? endDate = default(DateTime?))
        {
            throw new NotImplementedException();
        }
    }
}


text:
package org.globus.gsi.provider;

import org.globus.gsi.X509ProxyCertPathParameters;

import java.security.KeyStore;
import java.security.cert.CertStore;
import java.util.Map;

import javax.net.ssl.ManagerFactoryParameters;

import org.globus.gsi.proxy.ProxyPolicyHandler;

public class GlobusTrustManagerFactoryParameters implements
		ManagerFactoryParameters {

	private KeyStore initTrustStore;
	private CertStore initCRLStore;
	private SigningPolicyStore initPolicyStore;
	private boolean initRejectLimitedProxy;
	private Map<String, ProxyPolicyHandler> handlers;

	public GlobusTrustManagerFactoryParameters(KeyStore initTrustStore,
			CertStore initCRLStore, SigningPolicyStore initPolicyStore,
			boolean initRejectLimitedProxy) {
		this.initTrustStore = initTrustStore;
		this.initCRLStore = initCRLStore;
		this.initPolicyStore = initPolicyStore;
		this.initRejectLimitedProxy = initRejectLimitedProxy;
	}

	public GlobusTrustManagerFactoryParameters(KeyStore initTrustStore,
			CertStore initCRLStore, SigningPolicyStore initPolicyStore,
			boolean initRejectLimitedProxy,
			Map<String, ProxyPolicyHandler> handlers) {
		super();
		this.initTrustStore = initTrustStore;
		this.initCRLStore = initCRLStore;
		this.initPolicyStore = initPolicyStore;
		this.initRejectLimitedProxy = initRejectLimitedProxy;
		this.handlers = handlers;
	}

	public X509ProxyCertPathParameters getCertPathParameters() {
		if (this.handlers == null) {
			return new X509ProxyCertPathParameters(this.initTrustStore,
					this.initCRLStore, this.initPolicyStore,
					this.initRejectLimitedProxy);
		} else {
			return new X509ProxyCertPathParameters(this.initTrustStore,
					this.initCRLStore, this.initPolicyStore,
					this.initRejectLimitedProxy, this.handlers);
		}
	}

}


text:
[![Version][version-badge]][npm]
[![License][license-badge]][license]
[![Build][build-badge]][travis]
[![Coverage][coverage-badge]][coveralls]

[Install](#install) | [Usage](#usage) | [API](#api) | [TypeScript](#typescript) | [License](#license)

**Deep Map** recurses through an object and transforms its primitive values
– including nested values – according to some function. Essentially,
it's a deep version of [`Array.prototype.map()`][array-prototype-map] that
works on all objects rather than just on Arrays. Circular references are
supported.

To transform the *keys* of an object rather than its values, use
[Deep Map Keys][deep-map-keys].

## Install

Install Deep Map via [npm][npm].

```sh
npm install --save deep-map
```

## Usage

Let's say we have an object like this:

```js
const info = {
  name: '<%- name %>',
  email: '<%- email %>',
  keywords: ['<%- keyword1 %>', '<%- keyword2 %>'],
  hobbies: {
    primary: '<%- hobby1 %>',
    secondary: '<%- hobby2 %>'
  }
};
```

And we want to fill it with this data:

```js
const data = {
  name: 'Samuel Johnson',
  email: 'sam.johnson@dictionary.com',
  keyword1: 'dictionary',
  keyword2: 'lexicography',
  hobby1: 'writing',
  hobby2: 'torying',
};
```

We can use Deep Map like this:

```js
const deepMap = require('deep-map');
const template = require('lodash/template');

let result = deepMap(info, value => template(value)(data));
```

And the result looks like this:

```js
{
  name: 'Samuel Johnson',
  email: 'sam.johnson@dictionary.com',
  keywords: ['dictionary', 'lexicography'],
  hobbies: {
    primary: 'writing',
    secondary: 'torying'
  }
}
```

## API

#### `deepMap(object, mapFn, [options])`

#### Parameters

      Param
      Type
      Description

      object
      any

        The object whose values are to be transformed. Typically, this will be
        a complex object containing other nested objects. This object may be an

        Array, and may contain nested arrays whose values will
        be deeply transformed in the same way. The object may contain circular
        references.

      mapFn
      function

        The function used to transform each primitive value. The function is
        called with two arguments:

            value <any>
            The value being transformed.

            key <string | number>
            The key or index of the value being transformed. In the case
            of plain objects, this will be a string; in the case of arrays,
            this will be a number.

        The return value determines the value at the same position on the
        resulting object.

      [options]
      object

        An optional options object. The following options are accepted:

            inPlace <boolean=false>
            Mutate object rather than constructing a new
            object. Nested objects will also be mutated.

            thisArg <any=undefined>
            Sets the value of
            this
            within mapFn().

#### Returns

Returns a new object with the same keys as `object`. If `options.inPlace` is set
to `true`, the original object is returned, mutated.

## TypeScript

[TypeScript][typescript] declarations are included in the package. Just import
the module, and things will just work.

By default, the compiler will assume that the return value will have the same
shape as the input object. In most use cases, this is likely to be true. But in
some cases – like the one below – the assumption breaks down.

```ts
function isPositive(n: number): boolean {
  return n >= 0;
}

// COMPILER ERROR: number not assignable to boolean :(
let bool: boolean = deepMap({n: 2}, isPositive).n;
```

Pass a type argument to describe the shape of the return value, and everything
will be happy.

```ts
let bool: boolean = deepMap<{n: boolean}>({n: 2}, isPositive).n; // :)
```

## License

Copyright © 2016–2019 Akim McMath. Licensed under the [MIT License][license].

[version-badge]: https://img.shields.io/npm/v/deep-map.svg?style=flat-square
[license-badge]: https://img.shields.io/npm/l/deep-map.svg?style=flat-square
[build-badge]: https://img.shields.io/travis/mcmath/deep-map/master.svg?style=flat-square
[coverage-badge]: https://img.shields.io/coveralls/mcmath/deep-map/master.svg?style=flat-square&service=github
[npm]: https://www.npmjs.com/package/deep-map
[license]: LICENSE
[travis]: https://travis-ci.org/mcmath/deep-map
[coveralls]: https://coveralls.io/github/mcmath/deep-map?branch=master
[deep-map-keys]: https://github.com/mcmath/deep-map-keys
[typescript]: http://www.typescriptlang.org/
[array-prototype-map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map