adversarial.js
adversarial.js copied to clipboard
NPM Package
Love this proof of concept. Would you consider packaging it for NPM installation?
Thanks! The library is designed for in-browser use rather than in Node. On the server side, there are many equivalent Python packages (e.g. CleverHans).
Happy to consider if there's a good use case though.
Lots of projects use npm for client-side package mangement! It's quite common to use npm with webpack to install packages from npm and process them into a client-side bundle with webpack for preprocessing. This is why there's actually lots of client-side only projects on npm, e.g., react-dom, d3 and others.
The particular use case that prompted me to want this is that Observable (an in-browser javascript notebook environment) uses a require
function that pulls from jsDelivr, which ultimately pulls from npm. If this were packaged for npm, I could import it into an observable notebook like so. This code does not currently work:
advjs = require('adversarial-js')
However, I did manage to find a workaround using jsDelivr's GitHub functionality—also had to swap in import
for require
for compatibility with ES6-style modules. This code works:
advjs = import('https://cdn.jsdelivr.net/gh/kennysong/adversarial.js@main/src/adversarial.js')
Let me know if you have any questions about these use cases!
Ah, thanks for the explanation! For now, I created a release on GitHub so you can import a stable version from jsDelivr:
advjs = import('https://cdn.jsdelivr.net/gh/kennysong/[email protected]/src/adversarial.js')
This should work for your in-browser use case w/ Observable, so please use it for now.
It'll take some time to properly publish the library on npm with tests, so I'll leave this issue open until then.
Thanks! Will use the stable release :) Much appreciated