Skip to content

Commit

Permalink
feat: include TypeScript types
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Apr 15, 2022
1 parent 8ab7884 commit 6ac3e22
Show file tree
Hide file tree
Showing 20 changed files with 2,065 additions and 2,944 deletions.
3 changes: 3 additions & 0 deletions cli.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
export {};
//# sourceMappingURL=cli.d.ts.map
1 change: 1 addition & 0 deletions cli.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node
'use strict'
const metal = require('./')

console.log(metal())
import metal from './index.js';
console.log(metal());
4 changes: 4 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
import metal from './index.js'

console.log(metal())
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface Options {
fragment?: 'start' | 'end';
}
export default function (options?: Options): string;
export {};
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict'
const words = require('./words.json')
const sample = require('lodash.sample')

module.exports = function (options = {}) {
if (!options.fragment) {
return `${sample(words.start)} ${sample(words.end)}`
}
return sample(words[options.fragment])
import words from './words.js';
import sample from 'lodash.sample';
export default function (options = {}) {
if (options.fragment == null) {
return `${sample(words.start)} ${sample(words.end)}`;
}
return sample(words[options.fragment]);
}
13 changes: 13 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import words from './words.js'
import sample from 'lodash.sample'

interface Options {
fragment?: 'start' | 'end'
}

export default function (options: Options = {}): string {
if (options.fragment == null) {
return `${sample(words.start) as string} ${sample(words.end) as string}`
}
return sample(words[options.fragment]) as string
}
Loading

0 comments on commit 6ac3e22

Please sign in to comment.