@necto/platform 1.1.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Necto
3
+ Copyright (c) Corinvo, LLC. and affiliates. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.d.mts CHANGED
@@ -9,4 +9,8 @@ declare const isMac: () => boolean;
9
9
 
10
10
  declare const isAndroid: () => any;
11
11
 
12
- export { isAndroid, isMac };
12
+ declare const isIPhone: () => boolean;
13
+ declare const isIPad: () => boolean;
14
+ declare const isIOS: () => boolean;
15
+
16
+ export { isAndroid, isIOS, isIPad, isIPhone, isMac };
package/dist/index.d.ts CHANGED
@@ -9,4 +9,8 @@ declare const isMac: () => boolean;
9
9
 
10
10
  declare const isAndroid: () => any;
11
11
 
12
- export { isAndroid, isMac };
12
+ declare const isIPhone: () => boolean;
13
+ declare const isIPad: () => boolean;
14
+ declare const isIOS: () => boolean;
15
+
16
+ export { isAndroid, isIOS, isIPad, isIPhone, isMac };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(n,t)=>{for(var o in t)e(n,o,{get:t[o],enumerable:!0})},u=(n,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of s(t))!d.call(n,r)&&r!==o&&e(n,r,{get:()=>t[r],enumerable:!(i=a(t,r))||i.enumerable});return n};var w=n=>u(e({},"__esModule",{value:!0}),n);var v={};f(v,{isAndroid:()=>c,isMac:()=>p});module.exports=w(v);function g(n){return typeof window<"u"&&window.navigator!=null?n.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}var p=function(){return g(/^Mac/i)};function l(n){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(t=>n.test(t.brand))||n.test(window.navigator.userAgent)}var c=function(){return l(/Android/i)};0&&(module.exports={isAndroid,isMac});
1
+ "use strict";var e=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},l=(t,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of u(n))!p.call(t,o)&&o!==r&&e(t,o,{get:()=>n[o],enumerable:!(a=w(n,o))||a.enumerable});return t};var c=t=>l(e({},"__esModule",{value:!0}),t);var A={};g(A,{isAndroid:()=>v,isIOS:()=>P,isIPad:()=>f,isIPhone:()=>d,isMac:()=>i});module.exports=c(A);function x(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):!1}var i=()=>x(/^Mac/i);function m(t){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(n=>t.test(n.brand))||t.test(window.navigator.userAgent)}var v=()=>m(/Android/i);function s(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):!1}var d=()=>s(/^iPhone/i),f=()=>s(/^iPad/i)||i()&&navigator.maxTouchPoints>1,P=()=>d()||f();0&&(module.exports={isAndroid,isIOS,isIPad,isIPhone,isMac});
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/isMac.ts","../src/isAndroid.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// This is a horrible device detector code, DO NOT USE IN ANY PROD CODE!!!\n\nexport * from \"./isMac\";\nexport * from \"./isAndroid\";","/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n //@ts-ignore\n ? re.test(window.navigator['userAgentData']?.platform || window.navigator.platform)\n : false;\n}\n\nexport const isMac = function () {\n return testPlatform(/^Mac/i);\n};","function testUserAgent(re: RegExp) {\n if (typeof window === 'undefined' || window.navigator == null) {\n return false;\n }\n return (\n //@ts-ignore\n window.navigator['userAgentData']?.brands.some((brand: {brand: string, version: string}) => re.test(brand.brand))\n ) ||\n re.test(window.navigator.userAgent);\n}\n\nexport const isAndroid = function () {\n return testUserAgent(/Android/i);\n};"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,EAAA,UAAAC,IAAA,eAAAC,EAAAJ,GCQA,SAASK,EAAaC,EAAY,CAChC,OAAO,OAAO,OAAW,KAAe,OAAO,WAAa,KAExDA,EAAG,KAAK,OAAO,UAAU,eAAkB,UAAY,OAAO,UAAU,QAAQ,EAChF,EACN,CAEO,IAAMC,EAAQ,UAAY,CAC/B,OAAOF,EAAa,OAAO,CAC7B,ECjBA,SAASG,EAAcC,EAAY,CACjC,OAAI,OAAO,OAAW,KAAe,OAAO,WAAa,KAChD,GAIP,OAAO,UAAU,eAAkB,OAAO,KAAMC,GAA4CD,EAAG,KAAKC,EAAM,KAAK,CAAC,GAElHD,EAAG,KAAK,OAAO,UAAU,SAAS,CACpC,CAEO,IAAME,EAAY,UAAY,CACnC,OAAOH,EAAc,UAAU,CACjC","names":["index_exports","__export","isAndroid","isMac","__toCommonJS","testPlatform","re","isMac","testUserAgent","re","brand","isAndroid"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/isMac.ts","../src/isAndroid.ts","../src/isIOS.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nexport * from './isMac';\nexport * from './isAndroid';\nexport * from './isIOS';\n","/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n ? //@ts-ignore\n re.test(window.navigator.platform)\n : false;\n}\n\nexport const isMac = () => testPlatform(/^Mac/i);\n","// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nfunction testUserAgent(re: RegExp) {\n if (typeof window === 'undefined' || window.navigator == null) {\n return false;\n }\n return (\n //@ts-ignore\n window.navigator.userAgentData?.brands.some(\n (brand: { brand: string; version: string }) => re.test(brand.brand)\n ) || re.test(window.navigator.userAgent)\n );\n}\n\nexport const isAndroid = () => testUserAgent(/Android/i);\n","// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nimport { isMac } from './isMac';\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n ? //@ts-ignore\n re.test(window.navigator.platform)\n : false;\n}\n\nexport const isIPhone = () => {\n return testPlatform(/^iPhone/i);\n};\n\nexport const isIPad = () => {\n return (\n testPlatform(/^iPad/i) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1)\n );\n};\n\nexport const isIOS = () => {\n return isIPhone() || isIPad();\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,EAAA,UAAAC,EAAA,WAAAC,EAAA,aAAAC,EAAA,UAAAC,IAAA,eAAAC,EAAAP,GCYA,SAASQ,EAAaC,EAAY,CAChC,OAAO,OAAO,OAAW,KAAe,OAAO,WAAa,KAExDA,EAAG,KAAK,OAAO,UAAU,QAAQ,EACjC,EACN,CAEO,IAAMC,EAAQ,IAAMF,EAAa,OAAO,ECf/C,SAASG,EAAcC,EAAY,CACjC,OAAI,OAAO,OAAW,KAAe,OAAO,WAAa,KAChD,GAIP,OAAO,UAAU,eAAe,OAAO,KACpCC,GAA8CD,EAAG,KAAKC,EAAM,KAAK,CACpE,GAAKD,EAAG,KAAK,OAAO,UAAU,SAAS,CAE3C,CAEO,IAAME,EAAY,IAAMH,EAAc,UAAU,ECVvD,SAASI,EAAaC,EAAY,CAChC,OAAO,OAAO,OAAW,KAAe,OAAO,WAAa,KAExDA,EAAG,KAAK,OAAO,UAAU,QAAQ,EACjC,EACN,CAEO,IAAMC,EAAW,IACfF,EAAa,UAAU,EAGnBG,EAAS,IAElBH,EAAa,QAAQ,GAEpBI,EAAM,GAAK,UAAU,eAAiB,EAI9BC,EAAQ,IACZH,EAAS,GAAKC,EAAO","names":["index_exports","__export","isAndroid","isIOS","isIPad","isIPhone","isMac","__toCommonJS","testPlatform","re","isMac","testUserAgent","re","brand","isAndroid","testPlatform","re","isIPhone","isIPad","isMac","isIOS"]}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- function r(n){return typeof window<"u"&&window.navigator!=null?n.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}var e=function(){return r(/^Mac/i)};function o(n){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(t=>n.test(t.brand))||n.test(window.navigator.userAgent)}var a=function(){return o(/Android/i)};export{a as isAndroid,e as isMac};
1
+ function e(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):!1}var n=()=>e(/^Mac/i);function i(t){return typeof window>"u"||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(r=>t.test(r.brand))||t.test(window.navigator.userAgent)}var f=()=>i(/Android/i);function o(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):!1}var a=()=>o(/^iPhone/i),s=()=>o(/^iPad/i)||n()&&navigator.maxTouchPoints>1,p=()=>a()||s();export{f as isAndroid,p as isIOS,s as isIPad,a as isIPhone,n as isMac};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/isMac.ts","../src/isAndroid.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n //@ts-ignore\n ? re.test(window.navigator['userAgentData']?.platform || window.navigator.platform)\n : false;\n}\n\nexport const isMac = function () {\n return testPlatform(/^Mac/i);\n};","function testUserAgent(re: RegExp) {\n if (typeof window === 'undefined' || window.navigator == null) {\n return false;\n }\n return (\n //@ts-ignore\n window.navigator['userAgentData']?.brands.some((brand: {brand: string, version: string}) => re.test(brand.brand))\n ) ||\n re.test(window.navigator.userAgent);\n}\n\nexport const isAndroid = function () {\n return testUserAgent(/Android/i);\n};"],"mappings":"AAQA,SAASA,EAAaC,EAAY,CAChC,OAAO,OAAO,OAAW,KAAe,OAAO,WAAa,KAExDA,EAAG,KAAK,OAAO,UAAU,eAAkB,UAAY,OAAO,UAAU,QAAQ,EAChF,EACN,CAEO,IAAMC,EAAQ,UAAY,CAC/B,OAAOF,EAAa,OAAO,CAC7B,ECjBA,SAASG,EAAcC,EAAY,CACjC,OAAI,OAAO,OAAW,KAAe,OAAO,WAAa,KAChD,GAIP,OAAO,UAAU,eAAkB,OAAO,KAAMC,GAA4CD,EAAG,KAAKC,EAAM,KAAK,CAAC,GAElHD,EAAG,KAAK,OAAO,UAAU,SAAS,CACpC,CAEO,IAAME,EAAY,UAAY,CACnC,OAAOH,EAAc,UAAU,CACjC","names":["testPlatform","re","isMac","testUserAgent","re","brand","isAndroid"]}
1
+ {"version":3,"sources":["../src/isMac.ts","../src/isAndroid.ts","../src/isIOS.ts"],"sourcesContent":["/**\n * Copyright (c) Corinvo, LLC. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n ? //@ts-ignore\n re.test(window.navigator.platform)\n : false;\n}\n\nexport const isMac = () => testPlatform(/^Mac/i);\n","// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nfunction testUserAgent(re: RegExp) {\n if (typeof window === 'undefined' || window.navigator == null) {\n return false;\n }\n return (\n //@ts-ignore\n window.navigator.userAgentData?.brands.some(\n (brand: { brand: string; version: string }) => re.test(brand.brand)\n ) || re.test(window.navigator.userAgent)\n );\n}\n\nexport const isAndroid = () => testUserAgent(/Android/i);\n","// WARNING: This code is not recommended for use.\n// It contains significant issues and may lead to unexpected behavior.\n// Please avoid using or referencing this implementation.\n\nimport { isMac } from './isMac';\n\nfunction testPlatform(re: RegExp) {\n return typeof window !== 'undefined' && window.navigator != null\n ? //@ts-ignore\n re.test(window.navigator.platform)\n : false;\n}\n\nexport const isIPhone = () => {\n return testPlatform(/^iPhone/i);\n};\n\nexport const isIPad = () => {\n return (\n testPlatform(/^iPad/i) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1)\n );\n};\n\nexport const isIOS = () => {\n return isIPhone() || isIPad();\n};\n"],"mappings":"AAYA,SAASA,EAAaC,EAAY,CAChC,OAAO,OAAO,OAAW,KAAe,OAAO,WAAa,KAExDA,EAAG,KAAK,OAAO,UAAU,QAAQ,EACjC,EACN,CAEO,IAAMC,EAAQ,IAAMF,EAAa,OAAO,ECf/C,SAASG,EAAcC,EAAY,CACjC,OAAI,OAAO,OAAW,KAAe,OAAO,WAAa,KAChD,GAIP,OAAO,UAAU,eAAe,OAAO,KACpCC,GAA8CD,EAAG,KAAKC,EAAM,KAAK,CACpE,GAAKD,EAAG,KAAK,OAAO,UAAU,SAAS,CAE3C,CAEO,IAAME,EAAY,IAAMH,EAAc,UAAU,ECVvD,SAASI,EAAaC,EAAY,CAChC,OAAO,OAAO,OAAW,KAAe,OAAO,WAAa,KAExDA,EAAG,KAAK,OAAO,UAAU,QAAQ,EACjC,EACN,CAEO,IAAMC,EAAW,IACfF,EAAa,UAAU,EAGnBG,EAAS,IAElBH,EAAa,QAAQ,GAEpBI,EAAM,GAAK,UAAU,eAAiB,EAI9BC,EAAQ,IACZH,EAAS,GAAKC,EAAO","names":["testPlatform","re","isMac","testUserAgent","re","brand","isAndroid","testPlatform","re","isIPhone","isIPad","isMac","isIOS"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@necto/platform",
3
- "version": "1.1.0",
3
+ "version": "1.4.0",
4
4
  "description": "Necto's library for detecting platforms, devices, other device related information.",
5
5
  "files": [
6
6
  "dist",