Skip to main content
Version: 1.0.2

is.ipod

is.ipod(target: unknown)โ€‹

The is.ipod method is not part of the standard JavaScript library, so it's likely that it's a method from a third-party library or framework. Without more context, it's difficult to provide a specific answer.

However, if you're looking to check if the current device is an iPod using plain JavaScript, one way to do it is to check the user agent string. The user agent is a string that the browser sends along with every request, and it contains information about the browser and the device.

Specificationโ€‹

  • Target argument: optional.
  • Return: boolean.

Informationโ€‹

  • Unit tests: โœ…

Examplesโ€‹

is.ipod() // true if the command is executed in a browser running on the iPod
is.ipod('Mozilla/5.0 (iPod; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1') // true

// Alternative
IsConfig.state.userAgent = 'Mozilla/5.0 (iPod; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1';
is.ipod() // true

is.ipod(769) // false
is.ipod(false) // false
is.ipod(new Boolean(0)) // false
is.ipod(new Boolean()) // false
is.ipod(0) // false
is.ipod('') // false
is.ipod({}) // false
is.ipod([]) // false
// And all other known types will return false

Reversal boolean resultโ€‹

is.not.ipod() // false if the command is executed in a browser running on the iPod
is.not.ipod('Mozilla/5.0 (iPod; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1') // false

// Alternative
IsConfig.state.userAgent = 'Mozilla/5.0 (iPod; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1';
is.not.ipod() // false

is.not.ipod(769) // true
is.not.ipod(false) // true
is.not.ipod(new Boolean(0)) // true
is.not.ipod(new Boolean()) // true
is.not.ipod(0) // true
is.not.ipod('') // true
is.not.ipod({}) // true
is.not.ipod([]) // true
// And all other known types will return true