Skip to content

It’s not “device” but “OS”. #2

Description

@jenstroeger

I think the naming here is somewhat misleading: the user agent string contains the OS on which the browser is running, not the device. In the case of Apple’s iOS devices though the agent string seems to contain a hint of the device, all of which run iOS.

Thus I’d like to propose to rename whatever use of “device” to “os”, and perhaps expand the returned structure to

{browser: , os: , device: }

where os takes the role of the current device. Furthermore, it should be MacOS instead of Macintosh, and iOS in case of any one of the iDevices. For os: "iOS" then the device entry can be set to iPad/iPhone/iPod or to undefined otherwise.

This would be a breaking change, yes 😉

One more thing: instead of exporting an anonymous function, why not export a function name like detect()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions