Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
get-user-packages.js
const request = require('simple-get')
const getNpmUserPackages = name =>
new Promise(resolve => {
let packages = []
function req(page, cb) {
let url = `https://www.npmjs.com/profile/${name}/packages?offset=${page}`
request.concat(url, (e, _, data) => {
if (e) return reject(e)
const json = JSON.parse(data.toString())
packages = packages.concat(json.objects)
if (json.hasMore) {
req(page + 1, cb)
} else {
cb(packages)
}
})
}
req(0, resolve)
})
getNpmUserPackages('jbucaran')
.then(packages => {
return packages.map(pkg => pkg.name).sort()
})
.then(res => JSON.stringify(res, 0, 2))
.then(console.log)
@tunnckoCore
Copy link
Author

tunnckoCore commented Aug 7, 2017

example

[
  "@hyperapp/router",
  "acca",
  "acer",
  "acoelorrhaphe",
  "adansonia",
  "ailurophile",
  "altercation",
  "americium",
  "antimony",
  "archbox",
  "array-mat",
  "attacks",
  "attractive",
  "bagger",
  "baleric",
  "bartailed",
  "becoming",
  "beginning",
  "beleaguer",
  "berkelium",
  "beryllium",
  "bewicks",
  "bittersweet",
  "blackcap",
  "blackheaded",
  "blacknecked",
  "blacktailed",
  "blackthroated",
  "blond",
  "boab",
  "boaboa",
  "bohrium",
  "boxtron",
  "brambling",
  "brant",
  "brent",
  "bucolic",
  "buffbreasted",
  "buildpack",
  "bullfinch",
  "bundlefy",
  "bundletron",
  "bundlezoid",
  "bunting",
  "burnt",
  "byun",
  "cadet",
  "cadmium",
  "californium",
  "camphor",
  "carefree",
  "catlover",
  "celeste",
  "centaurus",
  "cerise",
  "chaffinch",
  "champagne",
  "chatoyant",
  "chilena",
  "chough",
  "clor",
  "clove",
  "cobundle",
  "collared",
  "complicated",
  "conflict",
  "coot",
  "corncrake",
  "cornflower",
  "corys",
  "create-browser-app",
  "create-es6-project",
  "create-js-boilerplate",
  "create-js-library",
  "create-js-project",
  "create-node-app",
  "create-node-boilerplate",
  "create-node-lib",
  "create-node-pkg",
  "createtron",
  "creatron",
  "cro",
  "crossbill",
  "cub",
  "curlew",
  "cyberapp",
  "cybercat",
  "cyberforce",
  "cyberstream",
  "cyberx",
  "cylinder",
  "darmstadtium",
  "devilfront",
  "devilmaker",
  "devilpack",
  "deviltron",
  "dipper",
  "driver",
  "dubnium",
  "dunlin",
  "dunnock",
  "dysprosium",
  "einsteinium",
  "eke",
  "europium",
  "example-rise",
  "exhaust",
  "fandango",
  "federal",
  "feijoa",
  "fisherman",
  "flea",
  "flerovium",
  "fly-cssnext",
  "fly-define",
  "fly-ember",
  "fly-emblem",
  "fly-eslint",
  "fly-esperanto",
  "fly-handlebars",
  "fly-less",
  "fly-mocha",
  "fly-util",
  "forming",
  "francium",
  "frontdev",
  "fronter",
  "frontpack",
  "g8",
  "gadolinium",
  "gallium",
  "gamboge",
  "generator-es-nm",
  "generator-pizza",
  "generator-rise",
  "get-next",
  "getopts",
  "godwit",
  "goyavier",
  "grunt-js2jade",
  "guavasteen",
  "guayaba",
  "guillemot",
  "gutz",
  "hatmaker",
  "hawthorn",
  "holmium",
  "honeydew",
  "hyper-route",
  "hyper-router",
  "hyper-switch",
  "hyperacid",
  "hyperacidities",
  "hyperacidity",
  "hyperactives",
  "hyperactivities",
  "hyperactivity",
  "hyperacuities",
  "hyperacuity",
  "hyperacute",
  "hyperaesthesia",
  "hyperaesthesias",
  "hyperaesthetic",
  "hyperaggressive",
  "hyperalert",
  "hyperalimentation",
  "hyperalimentations",
  "hyperapp",
  "hyperapp-app",
  "hyperapp-cli",
  "hyperapp-create",
  "hyperapp-create-app",
  "hyperapp-navigator",
  "hyperapp-router",
  "hyperapp-scaffold",
  "hyperapp-start",
  "hyperapp-tap",
  "hyperarg",
  "hyperarid",
  "hyperarousal",
  "hyperarousals",
  "hyperaware",
  "hyperawareness",
  "hyperawarenesses",
  "hyperawk",
  "hyperbaric",
  "hyperbarically",
  "hyperbeam",
  "hyperbit",
  "hyperbola",
  "hyperbolae",
  "hyperbolas",
  "hyperboles",
  "hyperbolical",
  "hyperbolically",
  "hyperbolist",
  "hyperbolists",
  "hyperbolize",
  "hyperbolized",
  "hyperbolizes",
  "hyperbolizing",
  "hyperboloid",
  "hyperboloidal",
  "hyperboloids",
  "hyperborean",
  "hyperboreans",
  "hyperbot",
  "hyperbox",
  "hyperbug",
  "hyperbundle",
  "hyperbus",
  "hypercalcemia",
  "hypercalcemias",
  "hypercalcemic",
  "hypercapnia",
  "hypercapnias",
  "hypercapnic",
  "hypercatabolism",
  "hypercatabolisms",
  "hypercatalectic",
  "hypercatalexes",
  "hypercatalexis",
  "hypercautious",
  "hypercom",
  "hypercon",
  "hypercut",
  "hyperdo",
  "hyperelf",
  "hyperelm",
  "hyperfiber",
  "hyperfly",
  "hyperfn",
  "hyperforce",
  "hyperfunction",
  "hypergen",
  "hyperhip",
  "hyperhole",
  "hyperjet",
  "hyperk",
  "hyperknot",
  "hyperload",
  "hypermake",
  "hypermarkup",
  "hypernaut",
  "hypernav",
  "hypernet",
  "hyperpack",
  "hyperpath",
  "hyperpop",
  "hyperq",
  "hyperrun",
  "hypersed",
  "hyperseq",
  "hypership",
  "hyperstage",
  "hyperstop",
  "hyperstring",
  "hypert",
  "hypertag",
  "hypertap",
  "hyperteam",
  "hypertemplate",
  "hyperthread",
  "hyperthru",
  "hypertml",
  "hypertron",
  "hypertroop",
  "hypertube",
  "hyperun",
  "hyperw",
  "hyperwave",
  "hyperway",
  "hyperworld",
  "hyperx-to-snabbdom",
  "hyperzoid",
  "imbrication",
  "incipient",
  "indium",
  "ineffable",
  "inexpressible",
  "inglenook",
  "ino",
  "insouciance",
  "inure",
  "kron",
  "kthulhu",
  "labyrinthine",
  "lagniappe",
  "lanthanum",
  "lawrencium",
  "licorice",
  "livermorium",
  "lutetium",
  "madball",
  "madiera",
  "magicmint",
  "marigold",
  "megazoid",
  "meitnerium",
  "mendelevium",
  "mixtape",
  "molybdenum",
  "montevideo",
  "morel",
  "morels",
  "moyai",
  "mu-x",
  "mudball",
  "mugwort",
  "mujs",
  "muppet",
  "muppets",
  "muscat",
  "nanobus",
  "navajo",
  "neodymium",
  "neptunium",
  "new-hyperapp-project",
  "new-node-pkg",
  "new-node-project",
  "niobium",
  "nonchalance",
  "nu-x",
  "nujs",
  "ole",
  "overlapping",
  "packtron",
  "parabox",
  "parabundle",
  "parsebool",
  "parsec",
  "paurotis",
  "periwinkle",
  "persimmon",
  "phosphorus",
  "picodom",
  "polonium",
  "potassium",
  "powerdom",
  "praseodymium",
  "protactinium",
  "pugx",
  "redstart",
  "rhenium",
  "rhodium",
  "roentgenium",
  "rquire",
  "rural",
  "ruthenium",
  "rutherfordium",
  "samarium",
  "savory",
  "scandium",
  "scoter",
  "seaborgium",
  "selector",
  "sellowiana",
  "sget",
  "shearwater",
  "softpack",
  "speciesbaobab",
  "specieseverglades",
  "speciesmaple",
  "strontium",
  "superapp",
  "superbox",
  "superbundle",
  "tangerine",
  "tantalum",
  "technetium",
  "terbium",
  "timberwolf",
  "tit",
  "to-amd",
  "tokyojs",
  "turbo",
  "turboapp",
  "turbodom",
  "turbodrive",
  "turbotron",
  "turbox",
  "turquoise",
  "twisting",
  "ultramarine",
  "ultrapink",
  "ultrapp",
  "unjs",
  "ununoctium",
  "ununpentium",
  "ununseptium",
  "ununtrium",
  "unutterable",
  "upside",
  "verdigris",
  "wahoo",
  "webarch",
  "webtron",
  "wregex",
  "wrightii",
  "yieldables",
  "yo-yo-app",
  "yo-yo-yo",
  "ytterbium",
  "yttrium",
  "zundle"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment