Clean up the oopsie. Rebuild the blank exercises.

This commit is contained in:
Michael Frank
2021-05-09 00:39:21 +12:00
parent b984cb4c6f
commit d28d80c46f
1565 changed files with 27186 additions and 199003 deletions
-7
View File
@@ -1,7 +0,0 @@
language: node_js
node_js:
- 'node'
- '5'
- '4'
- '0.12'
- '0.10'
+12 -11
View File
@@ -1,8 +1,8 @@
{
"_from": "safe-buffer@~5.1.1",
"_id": "safe-buffer@5.1.1",
"_id": "safe-buffer@5.1.2",
"_inBundle": false,
"_integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
"_integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"_location": "/safe-buffer",
"_phantomChildren": {},
"_requested": {
@@ -16,13 +16,14 @@
"fetchSpec": "~5.1.1"
},
"_requiredBy": [
"/readable-stream",
"/string_decoder"
"/convert-source-map",
"/request",
"/tunnel-agent"
],
"_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
"_shasum": "893312af69b2123def71f57889001671eeb2c853",
"_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"_shasum": "991ec69d296e0313747d59bdfd2b745c35f8828d",
"_spec": "safe-buffer@~5.1.1",
"_where": "/Users/cloyd/coderrr/odin/javascript-exercises/node_modules/readable-stream",
"_where": "/home/michael/projects/javascript-exercises/node_modules/convert-source-map",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
@@ -36,8 +37,7 @@
"description": "Safer Node.js Buffer API",
"devDependencies": {
"standard": "*",
"tape": "^4.0.0",
"zuul": "^3.0.0"
"tape": "^4.0.0"
},
"homepage": "https://github.com/feross/safe-buffer",
"keywords": [
@@ -57,7 +57,8 @@
"url": "git://github.com/feross/safe-buffer.git"
},
"scripts": {
"test": "standard && tape test.js"
"test": "standard && tape test/*.js"
},
"version": "5.1.1"
"types": "index.d.ts",
"version": "5.1.2"
}
-101
View File
@@ -1,101 +0,0 @@
/* eslint-disable node/no-deprecated-api */
var test = require('tape')
var SafeBuffer = require('./').Buffer
test('new SafeBuffer(value) works just like Buffer', function (t) {
t.deepEqual(new SafeBuffer('hey'), new Buffer('hey'))
t.deepEqual(new SafeBuffer('hey', 'utf8'), new Buffer('hey', 'utf8'))
t.deepEqual(new SafeBuffer('686579', 'hex'), new Buffer('686579', 'hex'))
t.deepEqual(new SafeBuffer([1, 2, 3]), new Buffer([1, 2, 3]))
t.deepEqual(new SafeBuffer(new Uint8Array([1, 2, 3])), new Buffer(new Uint8Array([1, 2, 3])))
t.equal(typeof SafeBuffer.isBuffer, 'function')
t.equal(SafeBuffer.isBuffer(new SafeBuffer('hey')), true)
t.equal(Buffer.isBuffer(new SafeBuffer('hey')), true)
t.notOk(SafeBuffer.isBuffer({}))
t.end()
})
test('SafeBuffer.from(value) converts to a Buffer', function (t) {
t.deepEqual(SafeBuffer.from('hey'), new Buffer('hey'))
t.deepEqual(SafeBuffer.from('hey', 'utf8'), new Buffer('hey', 'utf8'))
t.deepEqual(SafeBuffer.from('686579', 'hex'), new Buffer('686579', 'hex'))
t.deepEqual(SafeBuffer.from([1, 2, 3]), new Buffer([1, 2, 3]))
t.deepEqual(SafeBuffer.from(new Uint8Array([1, 2, 3])), new Buffer(new Uint8Array([1, 2, 3])))
t.end()
})
test('SafeBuffer.alloc(number) returns zeroed-out memory', function (t) {
for (var i = 0; i < 10; i++) {
var expected1 = new Buffer(1000)
expected1.fill(0)
t.deepEqual(SafeBuffer.alloc(1000), expected1)
var expected2 = new Buffer(1000 * 1000)
expected2.fill(0)
t.deepEqual(SafeBuffer.alloc(1000 * 1000), expected2)
}
t.end()
})
test('SafeBuffer.allocUnsafe(number)', function (t) {
var buf = SafeBuffer.allocUnsafe(100) // unitialized memory
t.equal(buf.length, 100)
t.equal(SafeBuffer.isBuffer(buf), true)
t.equal(Buffer.isBuffer(buf), true)
t.end()
})
test('SafeBuffer.from() throws with number types', function (t) {
t.plan(5)
t.throws(function () {
SafeBuffer.from(0)
})
t.throws(function () {
SafeBuffer.from(-1)
})
t.throws(function () {
SafeBuffer.from(NaN)
})
t.throws(function () {
SafeBuffer.from(Infinity)
})
t.throws(function () {
SafeBuffer.from(99)
})
})
test('SafeBuffer.allocUnsafe() throws with non-number types', function (t) {
t.plan(4)
t.throws(function () {
SafeBuffer.allocUnsafe('hey')
})
t.throws(function () {
SafeBuffer.allocUnsafe('hey', 'utf8')
})
t.throws(function () {
SafeBuffer.allocUnsafe([1, 2, 3])
})
t.throws(function () {
SafeBuffer.allocUnsafe({})
})
})
test('SafeBuffer.alloc() throws with non-number types', function (t) {
t.plan(4)
t.throws(function () {
SafeBuffer.alloc('hey')
})
t.throws(function () {
SafeBuffer.alloc('hey', 'utf8')
})
t.throws(function () {
SafeBuffer.alloc([1, 2, 3])
})
t.throws(function () {
SafeBuffer.alloc({})
})
})