Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v0.15.0 #46

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 5
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": "eslint:recommended",
"env": {
"commonjs": true
},
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"

- uses: actions/setup-node@v1
with:
node-version: "10"
node-version: "14"

- name: Install dependencies
run: |
Expand Down
16 changes: 8 additions & 8 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"url": "https://github.com/purescript-node/purescript-node-buffer.git"
},
"dependencies": {
"purescript-arraybuffer-types": "^3.0.0",
"purescript-effect": "^3.0.0",
"purescript-maybe": "^5.0.0",
"purescript-st": "^5.0.0",
"purescript-unsafe-coerce": "^5.0.0"
"purescript-arraybuffer-types": "main",
"purescript-effect": "master",
"purescript-maybe": "master",
"purescript-st": "master",
"purescript-unsafe-coerce": "master"
},
"devDependencies": {
"purescript-assert": "^5.0.0",
"purescript-console": "^5.0.0",
"purescript-foldable-traversable": "^5.0.0"
"purescript-assert": "master",
"purescript-console": "master",
"purescript-foldable-traversable": "master"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"devDependencies": {
"eslint": "^7.15.0",
"pulp": "^15.0.0",
"purescript-psa": "^0.8.0",
"pulp": "16.0.0-0",
"purescript-psa": "^0.8.2",
"rimraf": "^3.0.2"
}
}
99 changes: 49 additions & 50 deletions src/Node/Buffer/Immutable.js
Original file line number Diff line number Diff line change
@@ -1,100 +1,99 @@
/* global Buffer */
"use strict";
import { inspect } from "util";
export const showImpl = inspect;

exports.showImpl = require("util").inspect;

exports.eqImpl = function (a) {
return function (b) {
export function eqImpl(a) {
return b => {
return a.equals(b);
};
};
}

exports.compareImpl = function (a) {
return function (b) {
export function compareImpl(a) {
return b => {
return a.compare(b);
};
};
}

exports.create = function (size) {
export function create(size) {
return Buffer.alloc(size);
};
}

exports.fromArray = function (octets) {
export function fromArray(octets) {
return Buffer.from(octets);
};
}

exports.size = function (buff) {
export function size(buff) {
return buff.length;
};
}

exports.toArray = function (buff) {
export function toArray(buff) {
var json = buff.toJSON();
return json.data || json;
};
}

exports.toArrayBuffer = function (buff) {
export function toArrayBuffer(buff) {
return buff.buffer.slice(buff.byteOffset, buff.byteOffset + buff.byteLength);
};
}

exports.fromArrayBuffer = function (ab) {
export function fromArrayBuffer(ab) {
return Buffer.from(ab);
};
}

exports.fromStringImpl = function (str) {
return function (encoding) {
export function fromStringImpl(str) {
return encoding => {
return Buffer.from(str, encoding);
};
};
}

exports.readImpl = function (ty) {
return function (offset) {
return function (buf) {
export function readImpl(ty) {
return offset => {
return buf => {
return buf["read" + ty](offset);
};
};
};
}

exports.readStringImpl = function (enc) {
return function (start) {
return function (end) {
return function (buff) {
export function readStringImpl(enc) {
return start => {
return end => {
return buff => {
return buff.toString(enc, start, end);
};
};
};
};
}

exports.getAtOffsetImpl = function (just) {
return function (nothing) {
return function (offset) {
return function (buff) {
export function getAtOffsetImpl(just) {
return nothing => {
return offset => {
return buff => {
var octet = buff[offset];
return octet == null ? nothing : just(octet);
};
};
};
};
}

exports.toStringImpl = function (enc) {
return function (buff) {
export function toStringImpl(enc) {
return buff => {
return buff.toString(enc);
};
};
}

exports.slice = function (start) {
return function (end) {
return function (buff) {
export function slice(start) {
return end => {
return buff => {
return buff.slice(start, end);
};
};
};
}

exports.concat = function (buffs) {
export function concat(buffs) {
return Buffer.concat(buffs);
};
}

exports.concatToLength = function (buffs) {
return function (totalLength) {
export function concatToLength(buffs) {
return totalLength => {
return Buffer.concat(buffs, totalLength);
};
};
}
70 changes: 34 additions & 36 deletions src/Node/Buffer/Internal.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,68 @@
/* global Buffer */
"use strict";

exports.copyAll = function (a) {
return function () {
export function copyAll(a) {
return () => {
return Buffer.from(a);
};
};
}

exports.writeInternal = function (ty) {
return function (value) {
return function (offset) {
return function (buf) {
return function () {
export function writeInternal(ty) {
return value => {
return offset => {
return buf => {
return () => {
buf["write" + ty](value, offset);
};
};
};
};
};
}

exports.writeStringInternal = function (encoding) {
return function (offset) {
return function (length) {
return function (value) {
return function (buff) {
return function () {
export function writeStringInternal(encoding) {
return offset => {
return length => {
return value => {
return buff => {
return () => {
return buff.write(value, offset, length, encoding);
};
};
};
};
};
};
}

exports.setAtOffset = function (value) {
return function (offset) {
return function (buff) {
return function () {
export function setAtOffset(value) {
return offset => {
return buff => {
return () => {
buff[offset] = value;
};
};
};
};
}

exports.copy = function (srcStart) {
return function (srcEnd) {
return function (src) {
return function (targStart) {
return function (targ) {
return function () {
export function copy(srcStart) {
return srcEnd => {
return src => {
return targStart => {
return targ => {
return () => {
return src.copy(targ, targStart, srcStart, srcEnd);
};
};
};
};
};
};
}

exports.fill = function (octet) {
return function (start) {
return function (end) {
return function (buf) {
return function () {
export function fill(octet) {
return start => {
return end => {
return buf => {
return () => {
buf.fill(octet, start, end);
};
};
};
};
};
}
8 changes: 3 additions & 5 deletions src/Node/Encoding.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* global Buffer */
"use strict";

exports.byteLengthImpl = function (str) {
return function (enc) {
export function byteLengthImpl(str) {
return enc => {
return Buffer.byteLength(str, enc);
};
};
}