UNPKG

@web3r/flowerkit

Version:

Tree-shakable JavaScript and TypeScript utility library for frontend/browser apps: DOM, events, arrays, objects, strings, date, JSON, and network helpers (ESM/CJS, SSR-friendly).

1 lines 1.16 kB
{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TIsStrInCamelCaseArgs = Parameters<typeof isStrInCamelCase>;\r\n\r\nexport type TIsStrInCamelCaseReturn = ReturnType<typeof isStrInCamelCase>;\r\n\r\n/**\r\n * Checks if a string is in camelCase.\r\n * Rules:\r\n * Starts with lowercase letters\r\n * Contains one or more capitalized segments (e.g., \"abcDef\")\r\n *\r\n * @param {string} str Source string\r\n * @returns {boolean} True if string is camelCase\r\n * @throws {TypeError} If str is not a string\r\n * @example\r\n * isStrInCamelCase(\"abcDef\"); // true\r\n * isStrInCamelCase(\"Word\"); // false\r\n */\r\nexport const isStrInCamelCase = (str: string): boolean => {\r\n if (typeof str !== \"string\") {\r\n throw new TypeError(\"isStrInCamelCase: str must be a string\");\r\n }\r\n // eslint-disable-next-line security/detect-unsafe-regex\r\n return !!str.length && /^([a-z]+)(([A-Z]([a-z]+))+)$/.test(str);\r\n};\r\n"],"names":["isStrInCamelCase","str","TypeError","length","test"],"mappings":";;;;;;;;;;;;;AAiBO,MAAMA,iBAAoBC,MAC/B,UAAWA,MAAQ,SACjB,MAAM,IAAIC,UAAU;wDAGtB;QAASD,IAAIE,QAAU,+BAA+BC,KAAKH"}