Skip to content

Commit

Permalink
naturalise.. update Licence email
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Oct 2, 2024
1 parent bb2e6f5 commit 1d01d60
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 2,390 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [12, 14, 16, 18, 20, 22]

steps:
Expand All @@ -25,4 +26,5 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm i -g @75lb/nature
- run: npm run test:ci
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014-24 Lloyd Brookes <75pound@gmail.com>
Copyright (c) 2014-24 Lloyd Brookes <opensource@75lb.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ import ansi from './node_modules/ansi-escape-sequences/dist/index.mjs'

* * *

&copy; 2014-24 Lloyd Brookes \<75pound@gmail.com\>.
&copy; 2014-24 Lloyd Brookes \<opensource@75lb.com\>.

Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,6 @@ import ansi from './node_modules/ansi-escape-sequences/dist/index.mjs'

* * *

&copy; 2014-24 Lloyd Brookes \<75pound@gmail.com\>.
&copy; 2014-24 Lloyd Brookes \<opensource@75lb.com\>.

Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
57 changes: 1 addition & 56 deletions dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1,61 +1,6 @@
'use strict';

/**
* Takes any input and guarantees an array back.
*
* - Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
* - Converts `undefined` to an empty array.
* - Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
* - Ignores input which is already an array.
*
* @module array-back
* @example
* > const arrayify = require('array-back')
*
* > arrayify(undefined)
* []
*
* > arrayify(null)
* [ null ]
*
* > arrayify(0)
* [ 0 ]
*
* > arrayify([ 1, 2 ])
* [ 1, 2 ]
*
* > arrayify(new Set([ 1, 2 ]))
* [ 1, 2 ]
*
* > function f(){ return arrayify(arguments); }
* > f(1,2,3)
* [ 1, 2, 3 ]
*/

function isObject (input) {
return typeof input === 'object' && input !== null
}

function isArrayLike (input) {
return isObject(input) && typeof input.length === 'number'
}

/**
* @param {*} - The input value to convert to an array
* @returns {Array}
* @alias module:array-back
*/
function arrayify (input) {
if (Array.isArray(input)) {
return input
} else if (input === undefined) {
return []
} else if (isArrayLike(input) || input instanceof Set) {
return Array.from(input)
} else {
return [input]
}
}
var arrayify = require('array-back');

/* Control Sequence Initiator */
const csi = '\x1b[';
Expand Down
Loading

0 comments on commit 1d01d60

Please sign in to comment.