summaryrefslogtreecommitdiff
path: root/src/lstring.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-18 07:10:48 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-18 07:10:48 +1100
commit8bedd949c894d61284b3ddd5b3bf989b651b95f8 (patch)
treeeaad352ce3a25b115d2fce16f5d7e0f5db892700 /src/lstring.js
parent442789bad1bfaf101b5513859fffbec04aa8c153 (diff)
downloadfengari-8bedd949c894d61284b3ddd5b3bf989b651b95f8.tar.gz
fengari-8bedd949c894d61284b3ddd5b3bf989b651b95f8.tar.bz2
fengari-8bedd949c894d61284b3ddd5b3bf989b651b95f8.zip
src/lstring.js: Use destructuring assignment for defs.js
Diffstat (limited to 'src/lstring.js')
-rw-r--r--src/lstring.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lstring.js b/src/lstring.js
index 8a7e71b..4769866 100644
--- a/src/lstring.js
+++ b/src/lstring.js
@@ -1,6 +1,11 @@
"use strict";
-const defs = require('./defs.js');
+const {
+ is_luastring,
+ luastring_eq,
+ luastring_from,
+ to_luastring
+} = require('./defs.js');
const { lua_assert } = require("./llimits.js");
class TString {
@@ -23,13 +28,13 @@ class TString {
const luaS_eqlngstr = function(a, b) {
lua_assert(a instanceof TString);
lua_assert(b instanceof TString);
- return a == b || defs.luastring_eq(a.realstring, b.realstring);
+ return a == b || luastring_eq(a.realstring, b.realstring);
};
/* converts strings (arrays) to a consistent map key
make sure this doesn't conflict with any of the anti-collision strategies in ltable */
const luaS_hash = function(str) {
- lua_assert(defs.is_luastring(str));
+ lua_assert(is_luastring(str));
let len = str.length;
let s = "|";
for (let i=0; i<len; i++)
@@ -53,12 +58,12 @@ const luaS_bless = function(L, str) {
/* makes a copy */
const luaS_new = function(L, str) {
- return luaS_bless(L, defs.luastring_from(str));
+ return luaS_bless(L, luastring_from(str));
};
/* takes a js string */
const luaS_newliteral = function(L, str) {
- return luaS_bless(L, defs.to_luastring(str));
+ return luaS_bless(L, to_luastring(str));
};
module.exports.luaS_eqlngstr = luaS_eqlngstr;