@opndev/util 0.0.2 → 0.0.4

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Welcome to @opndev/util
2
2
 
3
3
  This is a utility function package that tries to solve issues by keeping things
4
- DRY.
4
+ DRY. It is an ESM package.
5
5
 
6
6
  ## Exports
7
7
 
@@ -38,7 +38,7 @@ The ES Linting profile is flexible and does not try to enforce much. There is
38
38
  more than one way to do it:
39
39
  [TIMTOWTDI](https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it)
40
40
 
41
- Try to stay constistent, but forcing a programming style upon others is bad.A
41
+ Try to stay constistent, but forcing a programming style upon others is bad.
42
42
 
43
43
  ### gitignore
44
44
 
@@ -48,10 +48,10 @@ always be there. I'm looking at you `node_modules`.
48
48
  ### The lockfiles
49
49
  You'll also see that `package-lock.json` and/or `yarn.lock` is ignored. I
50
50
  strongly believe that pinning packages lead to bit rot, as you never update
51
- packages. When a downstream module breaks it API you should now and update your
52
- code accordingly. The same goes for possible upstream modules. If you want a
53
- specific version, pin it to that version, otherwise use the latest and greatest
54
- when possible.
51
+ packages. When a downstream module breaks its API you should know and update
52
+ your code accordingly. The same goes for possible upstream modules. If you want
53
+ a specific version, pin it to that version, otherwise use the latest and
54
+ greatest when possible.
55
55
 
56
56
  ### Code of conduct
57
57
 
@@ -3,5 +3,7 @@
3
3
  * require.context we cannot automaticly load everything. So we just keep
4
4
  * typing. ES6 requires strict syntax on import and exports :/
5
5
  */
6
- export { any } from './any.js'
7
- export { defined } from './defined.js'
6
+ export { any } from './any.mjs'
7
+ export { defined } from './defined.mjs'
8
+ export { pow_of_two } from './powtwo.mjs'
9
+ export { is_pow_of_two } from './ispowtwo.mjs'
package/package.json CHANGED
@@ -1,18 +1,16 @@
1
1
  {
2
2
  "name": "@opndev/util",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Utility functions for OPN Development",
5
- "main": "lib/index.js",
6
- "esm": "auto",
5
+ "main": "lib/index.mjs",
7
6
  "repository": {
8
- "type": "git",
9
- "url" : "gitlab:opndev/opndev-js-util"
10
-
7
+ "url" : "gitlab:opndev/javascipt/opndev-js-util"
11
8
  },
12
9
  "bugs" : {
13
- "url" : "https://gitlab.com/opndev/opndev-js-util/issues"
10
+ "url" : "https://gitlab.com/opndev/javascript/opndev-js-util/issues"
14
11
  },
15
- "module": true,
12
+ "type": "module",
13
+ "mode":"auto",
16
14
  "scripts": {
17
15
  "test": "tap"
18
16
  },
@@ -23,10 +21,7 @@
23
21
  },
24
22
  "license": "MIT",
25
23
  "devDependencies": {
26
- "tap": "*"
27
- },
28
- "dependencies": {
29
- "esm": "*"
24
+ "tap": "latest"
30
25
  },
31
26
  "files": [
32
27
  "lib/*.js",
package/Changes DELETED
@@ -1,12 +0,0 @@
1
- Revision history for @opndev/util
2
-
3
- {{ NEXT }}
4
-
5
- 0.0.2 2020-05-15 16:19:23Z
6
-
7
- * Allow any() to check for integers as well
8
- * Update README.md
9
-
10
- 0.0.1 2020-05-13 02:42:33Z
11
-
12
- * First release
package/lib/any.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- *
5
- * Check if a value is preset in the given array, can be done via a function or
6
- * a primitive. Objects tend to be harder. Use lodash instead.
7
- *
8
- * @function any
9
- * @params {*} needle Anything
10
- * @params {Array} haystack Anything
11
- * @returns {Boolean} true if needle is found, false otherwise
12
- */
13
-
14
- function _assert_array(haystack) {
15
-
16
- if (Array.isArray(haystack))
17
- return
18
-
19
- throw "haystack is not an array";
20
- }
21
-
22
- export default function any(needle, haystack) {
23
-
24
- _assert_array(haystack)
25
-
26
- if (typeof needle === 'function')
27
- return haystack.some(needle)
28
-
29
- return haystack.includes(needle)
30
- }
31
-
32
- export { any }
33
-
package/lib/defined.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict"; // technically not needed as we write ES6
2
-
3
- /**
4
- * Check if a variable is defined
5
- * @params {Object} what Anything really
6
- * @returns {Boolean} true if defined, false otherwise
7
- */
8
-
9
- export default function defined(what) {
10
- if (what === null)
11
- return false
12
-
13
- if (typeof what === 'undefined')
14
- return false
15
-
16
- /* This will probably never be hit:
17
- * https://stackoverflow.com/questions/4725603/variable-undefined-vs-typeof-variable-undefined
18
- */
19
- if (what === undefined)
20
- return false
21
-
22
- return true
23
- }
24
-
25
- export { defined };
26
-