npm install facebook-nodejs-business-sdk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
+ "npmClient": "yarn", | |
+ "useWorkspaces": true, | |
"packages": ["packages/*"], | |
"version": "independent" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "root", | |
"private": true, | |
+ "workspaces": ["packages/*"], | |
"devDependencies": { | |
"lerna": "^4.0.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"packages": ["packages/*"], | |
- "version": "0.0.0" | |
+ "version": "independent" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hash('foo').then((hex) => console.log(hex)); // '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function hash(string) { | |
const utf8 = new TextEncoder().encode(string); | |
const hashBuffer = await crypto.subtle.digest('SHA-256', utf8); | |
const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
const hashHex = hashArray | |
.map((bytes) => bytes.toString(16).padStart(2, '0')) | |
.join(''); | |
return hashHex; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hash(string) { | |
const utf8 = new TextEncoder().encode(string); | |
return crypto.subtle.digest('SHA-256', utf8).then((hashBuffer) => { | |
const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
const hashHex = hashArray | |
.map((bytes) => bytes.toString(16).padStart(2, '0')) | |
.join(''); | |
return hashHex; | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(hash('foo')); // '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createHash } = require('crypto'); | |
function hash(string) { | |
return createHash('sha256').update(string).digest('hex'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rollup.config.js | |
import commonjs from '@rollup/plugin-commonjs'; | |
import import resolve from '@rollup/plugin-node-resolve'; | |
import { terser } from 'rollup-plugin-terser'; | |
+import json from '@rollup/plugin-json'; | |
const config = { | |
input: 'index.js', | |
output: { | |
format: 'umd', |