Skip to content

Commit

Permalink
fix: switch to as-typed-array
Browse files Browse the repository at this point in the history
  • Loading branch information
bconnorwhite committed Sep 20, 2020
1 parent 0f29850 commit 7191594
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ type Executable = {
<h2>Dependencies<img align="right" alt="dependencies" src="https://img.shields.io/david/bconnorwhite/exec.svg"></h2>
- [as-typed-array](https://npmjs.com/package/as-typed-array): Make any value an array, and maintain types
- [cross-spawn](https://npmjs.com/package/cross-spawn): Cross platform child_process#spawn and child_process#spawnSync
- [parse-json-object](https://npmjs.com/package/parse-json-object): Parse a typed JSON object.
- [strip-ansi](https://npmjs.com/package/strip-ansi): Strip ANSI escape codes from a string
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"test": "jest --coverage --coverage-reporters lcov"
},
"dependencies": {
"as-typed-array": "^1.0.0",
"cross-spawn": "^7.0.3",
"extract-first-json": "^1.0.1",
"strip-ansi": "^6.0.0",
Expand Down
9 changes: 1 addition & 8 deletions source/args/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asArray from "as-typed-array";
import { flag, Flags } from "./flags";

export type Arg = string | Flags;
Expand All @@ -23,14 +24,6 @@ export function flagsToArgs(flags: Flags = {}) {
}, ([] as string[]));
}

function asArray(args: Args) {
if(Array.isArray(args)) {
return args;
} else {
return [args];
}
}

// flagsToArgs should independently quote its output which why concat is after map
export function getArgs(args: Args = []) {
return asArray(args).reduce((retval, arg) => {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1738,6 +1738,11 @@ arrify@^1.0.1:
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=

as-typed-array@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/as-typed-array/-/as-typed-array-1.0.0.tgz#c179ad70ff364ee10b6531c3e6b79f9b235e39ad"
integrity sha512-qMd7L7RlfDrWXBgwOD/xTEg/UIVqgOqXPGn0I0VCNKm8RNsihub5G3SOxwEQbsMLowTfACat0B+itSwei0agLw==

asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
Expand Down

0 comments on commit 7191594

Please sign in to comment.