@opndev/util 0.0.6 → 0.0.8

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/Changes CHANGED
@@ -1,6 +1,15 @@
1
1
  Revision history for @opndev/util
2
2
 
3
- {{NEXT}}
3
+ 0.08 2024-06-04 11:55:03-0400
4
+
5
+ * Add ucFirst, lcFirst functions. Why doesn't JS have these in core?
6
+
7
+ 0.0.7 2024-01-19 14:19:56-0400
8
+
9
+ * Add additional information when throwing an error in pow functions
10
+ * Bump requirements for node-tap
11
+
12
+ 0.0.6 2023-09-03 17:20:58-0400
4
13
 
5
14
  * Maintainer release:
6
15
  * Make use of gitlab pages for documenation
@@ -12,7 +21,7 @@ Revision history for @opndev/util
12
21
 
13
22
  * Include .mjs files in package
14
23
 
15
- 0.0.4 2023-08-27 15:13:21-0400
24
+ 0.0.4 2023-08-27 15:13:21-0400
16
25
 
17
26
  * Add two mathematical functions:
18
27
  * is_pow_of_two
package/lib/index.mjs CHANGED
@@ -18,3 +18,5 @@ export { defined } from './defined.mjs'
18
18
  export { pow_of_two } from './powtwo.mjs'
19
19
  export { is_pow_of_two } from './ispowtwo.mjs'
20
20
  export { range } from './range.mjs'
21
+ export { ucFirst } from './ucFirst.mjs'
22
+ export { lcFirst } from './lcFirst.mjs'
package/lib/ispowtwo.mjs CHANGED
@@ -13,7 +13,7 @@
13
13
  export default function is_pow_of_two(i) {
14
14
  const parsed = Number.parseInt(i, 10);
15
15
  if (Number.isNaN(parsed))
16
- throw new Error("Not a number");
16
+ throw new Error(`${i} is not a number`);
17
17
 
18
18
  return (!(parsed & (parsed-1)) && parsed) ? true : false;
19
19
 
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check if a value is preset in the given array, can be done via a function or
3
+ * a primitive. Objects tend to be harder. Use lodash instead.
4
+ *
5
+ * @function lcFirst
6
+ * @param {String} string Anything
7
+ * @returns {String} string With the first letter uppercased
8
+ */
9
+ export default function lcFirst(string) {
10
+ return string.charAt(0).toLowerCase() + string.slice(1);
11
+ }
12
+
13
+ export { lcFirst }
package/lib/powtwo.mjs CHANGED
@@ -14,7 +14,7 @@
14
14
  export default function pow_of_two(i) {
15
15
  let parsed = Number.parseInt(i, 10);
16
16
  if (Number.isNaN(parsed))
17
- throw new Error("Not a number");
17
+ throw new Error(`${i} is not a number`);
18
18
 
19
19
  let count = 0;
20
20
  while (parsed != 1) {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check if a value is preset in the given array, can be done via a function or
3
+ * a primitive. Objects tend to be harder. Use lodash instead.
4
+ *
5
+ * @function ucFirst
6
+ * @param {String} string Anything
7
+ * @returns {String} string With the first letter uppercased
8
+ */
9
+ export default function ucFirst(string) {
10
+ return string.charAt(0).toUpperCase() + string.slice(1);
11
+ }
12
+
13
+ export { ucFirst }
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@opndev/util",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Utility functions for OPN Development",
5
5
  "main": "lib/index.mjs",
6
+ "type": "module",
7
+ "mode": "auto",
8
+ "sideEffects": false,
6
9
  "homepage": "https://opndev.gitlab.io/javascript/opndev-js-util/",
7
10
  "repository": {
8
11
  "url": "git+https://gitlab.com/opndev/javascript/opndev-js-util.git"
@@ -10,8 +13,6 @@
10
13
  "bugs": {
11
14
  "url": "https://gitlab.com/opndev/javascript/opndev-js-util/issues"
12
15
  },
13
- "type": "module",
14
- "mode": "auto",
15
16
  "scripts": {
16
17
  "test": "tap",
17
18
  "jsdoc" : "jsdoc -c jsdoc.json"