@opndev/util 0.0.7 → 0.0.9

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 ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-2024 Wesley Schwengle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/lib/any.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2021-2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  /**
2
6
  * Check if a value is preset in the given array, can be done via a function or
3
7
  * a primitive. Objects tend to be harder. Use lodash instead.
package/lib/defined.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2021-2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  /**
2
6
  * Check if a variable is defined
3
7
  * @function defined
package/lib/index.mjs CHANGED
@@ -1,3 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2021-2024, 2026 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
5
+ const VERSION = "0.0.9";
6
+
1
7
  /**
2
8
  *
3
9
  * @module module:@opndev/utils
@@ -18,3 +24,5 @@ export { defined } from './defined.mjs'
18
24
  export { pow_of_two } from './powtwo.mjs'
19
25
  export { is_pow_of_two } from './ispowtwo.mjs'
20
26
  export { range } from './range.mjs'
27
+ export { ucFirst } from './ucFirst.mjs'
28
+ export { lcFirst } from './lcFirst.mjs'
package/lib/ispowtwo.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2023, 2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  /**
2
6
  * Check if something is the power of two
3
7
  * @function is_pow_of_two
@@ -0,0 +1,17 @@
1
+ // SPDX-FileCopyrightText: 2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
5
+ /**
6
+ * Check if a value is preset in the given array, can be done via a function or
7
+ * a primitive. Objects tend to be harder. Use lodash instead.
8
+ *
9
+ * @function lcFirst
10
+ * @param {String} string Anything
11
+ * @returns {String} string With the first letter uppercased
12
+ */
13
+ export default function lcFirst(string) {
14
+ return string.charAt(0).toLowerCase() + string.slice(1);
15
+ }
16
+
17
+ export { lcFirst }
package/lib/none.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2023, 2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  /**
2
6
  * Check if a value is not preset in the given array, can be done via a
3
7
  * function or a primitive.
package/lib/powtwo.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2023, 2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  /**
2
6
  * Returns the power of two
3
7
  * @function pow_of_two
package/lib/range.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2023, 2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
1
5
  /**
2
6
  * Return a range
3
7
  * @function range
@@ -0,0 +1,17 @@
1
+ // SPDX-FileCopyrightText: 2024 Wesley Schwengle <wesley@opndev.io>
2
+ //
3
+ // SPDX-License-Identifier: MIT
4
+
5
+ /**
6
+ * Check if a value is preset in the given array, can be done via a function or
7
+ * a primitive. Objects tend to be harder. Use lodash instead.
8
+ *
9
+ * @function ucFirst
10
+ * @param {String} string Anything
11
+ * @returns {String} string With the first letter uppercased
12
+ */
13
+ export default function ucFirst(string) {
14
+ return string.charAt(0).toUpperCase() + string.slice(1);
15
+ }
16
+
17
+ export { ucFirst }
package/package.json CHANGED
@@ -1,35 +1,43 @@
1
1
  {
2
- "name": "@opndev/util",
3
- "version": "0.0.7",
4
- "description": "Utility functions for OPN Development",
5
- "main": "lib/index.mjs",
6
- "type": "module",
7
- "mode": "auto",
8
- "sideEffects": false,
9
- "homepage": "https://opndev.gitlab.io/javascript/opndev-js-util/",
10
- "repository": {
11
- "url": "git+https://gitlab.com/opndev/javascript/opndev-js-util.git"
12
- },
13
- "bugs": {
14
- "url": "https://gitlab.com/opndev/javascript/opndev-js-util/issues"
15
- },
16
- "scripts": {
17
- "test": "tap",
18
- "jsdoc" : "jsdoc -c jsdoc.json"
19
- },
20
2
  "author": {
21
- "name": "Wesley Schwengle",
22
3
  "email": "wesley@opndev.io",
4
+ "name": "Wesley Schwengle",
23
5
  "url": "https://opndev.io"
24
6
  },
25
- "license": "MIT",
7
+ "bugs": {
8
+ "url": "https://gitlab.com/opndev/javascript/opndev-js-util/-/issues"
9
+ },
10
+ "description": "Utility functions for OPN Development",
26
11
  "devDependencies": {
27
- "jsdoc" : "latest",
12
+ "jsdoc": "latest",
28
13
  "tap": "latest"
29
14
  },
30
- "files": [
31
- "lib/*.mjs",
32
- "README.md",
33
- "Changes"
34
- ]
15
+ "exports": {
16
+ ".": "./lib/index.mjs",
17
+ "./any": "./lib/any.mjs",
18
+ "./defined": "./lib/defined.mjs",
19
+ "./is_pow_of_two": "./lib/is_pow_of_two.mjs",
20
+ "./lcFirst": "./lib/lcFirst.mjs",
21
+ "./none": "./lib/none.mjs",
22
+ "./pow_of_two": "./lib/pow_of_two.mjs",
23
+ "./range": "./lib/range.mjs",
24
+ "./ucFirst": "./lib/ucFirst.mjs"
25
+ },
26
+ "homepage": "https://opndev.gitlab.io/javascript/opndev-js-util/",
27
+ "keywords": [
28
+ "utility"
29
+ ],
30
+ "license": "MIT",
31
+ "name": "@opndev/util",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://gitlab.com/opndev/javascript/opndev-js-util.git"
35
+ },
36
+ "scripts": {
37
+ "jsdoc": "jsdoc -c jsdoc.json",
38
+ "test": "tap"
39
+ },
40
+ "sideEffects": false,
41
+ "type": "module",
42
+ "version": "0.0.9"
35
43
  }
package/Changes DELETED
@@ -1,37 +0,0 @@
1
- Revision history for @opndev/util
2
-
3
- 0.0.7
4
-
5
- * Add additional information when throwing an error in pow functions
6
- * Bump requirements for node-tap
7
-
8
- 0.0.6
9
-
10
- * Maintainer release:
11
- * Make use of gitlab pages for documenation
12
- * Add none() function
13
- * Add range() function
14
- * Bugfix: Allow string values in pow_* functions
15
-
16
- 0.0.5 2023-08-27 15:33:21-0400
17
-
18
- * Include .mjs files in package
19
-
20
- 0.0.4 2023-08-27 15:13:21-0400
21
-
22
- * Add two mathematical functions:
23
- * is_pow_of_two
24
- * pow_of_two
25
-
26
- 0.0.3 2021-11-12 17:15:02-0400
27
-
28
- * maintainer release for ESM
29
-
30
- 0.0.2 2020-05-15 16:19:23Z
31
-
32
- * Allow any() to check for integers as well
33
- * Update README.md
34
-
35
- 0.0.1 2020-05-13 02:42:33Z
36
-
37
- * First release
package/README.md DELETED
@@ -1,49 +0,0 @@
1
- # Welcome to @opndev/util
2
-
3
- This is a utility function package that tries to solve issues by keeping things
4
- DRY. It is an ESM package.
5
-
6
- [If you want to know more, have a look at our documenation](https://opndev.gitlab.io/javascript/opndev-js-util/)
7
-
8
- ## Development
9
-
10
- Try to keep functions small and try not to depend on any outside functions. We
11
- aim to keep the dependency graph as small as possible. The use of `esm` is
12
- welcomed and writing tests is encouraged.
13
-
14
- ### jsdoc
15
-
16
- You can build the documentation by running `npm run jsdoc`.
17
-
18
- ### eslint
19
-
20
- The ES Linting profile is flexible and does not try to enforce much. There is
21
- more than one way to do it ([TIMTOWTDI](https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it)).
22
-
23
- Try to stay constistent, but forcing a programming style upon others is bad.
24
-
25
- ### gitignore
26
-
27
- Please educate yourself and use a global gitignore file. Somes files will
28
- always be there. I'm looking at you `node_modules`.
29
-
30
- ### The lockfiles
31
- You'll also see that `package-lock.json` and/or `yarn.lock` are ignored. I
32
- strongly believe that pinning packages lead to bit rot, as you never update
33
- packages. When a downstream module breaks its API you should know and update
34
- your code accordingly. The same goes for possible upstream modules. If you want
35
- a specific version, pin it to that version, otherwise use the latest and
36
- greatest when possible.
37
-
38
- ### Code of conduct
39
-
40
- There is none, stay human, communicate and accept that some people have
41
- different opinions.
42
-
43
- ### Pull requests
44
-
45
- I'm happy to accept pull requests, just make sure your change has tests.
46
- Add a good commit message and commit with a sign-off `git commit -s`.
47
-
48
- A good commit message isn't just `issue(feat): added foo to bar` but also
49
- explain the why in the commit.