Giter Site home page Giter Site logo

Comments (5)

danilaml avatar danilaml commented on August 19, 2024

@shiftkey btw, any reason HKEY enum holds strings, instead of values directly? Wouldn't need the clumsy mapToLong that way. (I've also found this package that does similar stuff: https://github.com/CatalystCode/windows-registry-node )

from registry-js.

shiftkey avatar shiftkey commented on August 19, 2024

btw, any reason HKEY enum holds strings, instead of values directly?

Convenience mostly. A string is a bit more readable for the caller to manage, so this:

import { enumerateValues, HKEY } from 'registry-js'

const values = enumerateValues(
  HKEY.HKEY_LOCAL_MACHINE,
  'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
)

Could just be written as this in JS (for callers who import this without having the TypeScript declarations available):

import { enumerateValues } from 'registry-js'

const values = enumerateValues(
  'HKEY_LOCAL_MACHINE',
  'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
)

from registry-js.

danilaml avatar danilaml commented on August 19, 2024

@shiftkey well, not sure if it's a good choice when the input value is an enum, i.e. can only be something of few predefined types. This saves only 3 chars to type but makes it easier to make a mistake, IMHO (in both, userCode and mapToLong). But whatever, I don't mind. Just asked)

from registry-js.

shiftkey avatar shiftkey commented on August 19, 2024

@danilaml no problem at all - it's early days for this and I'm basing this off my experiences working with the registry...

from registry-js.

j-f1 avatar j-f1 commented on August 19, 2024

@shiftkey enums appear in the compiled JS:

// from:
enum Foo {
  A = 'A',
  B = 'B',
  C = 'C',
}

// to:
var Foo;
(function (Foo) {
    Foo["A"] = "A";
    Foo["B"] = "B";
    Foo["C"] = "C";
})(Foo || (Foo = {}));

(see it live)

from registry-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.