<commit_before>const _ = require('./util/underscore.js')
const lexical = require('./lexical.js')
const assert = require('./util/assert.js')

var Scope = {
  getAll: function () {
    var ctx = {}
    for (var i = this.scopes.length - 1; i >= 0; i--) {
      _.assign(ctx, this.scopes[i])
    }
    return ctx
  },
  get: function (str) {
    if (str === 'liquid') {
      throw new Error('NO LONGER SUPPORTED: use scope.opts instread of scope.get("liquid")')
    }
    try {
      return this.getPropertyByPath(this.scopes, str)
    } catch (e) {
      if (!/undefined variable/.test(e.message) || this.opts.strict_variables) {
        throw e
      }
    }
  },
  set: function (k, v) {
    var scope = this.findScopeFor(k)
    setPropertyByPath(scope, k, v)
    return this
  },
  push: function (ctx) {
    assert(ctx, `trying to push ${ctx} into scopes`)
    return this.scopes.push(ctx)
  },
  pop: function () {
    return this.scopes.pop()<commit_msg>fix: typo in scope.get("liquid") error message, fixes #50<commit_after>const _ = require('./util/underscore.js')
const lexical = require('./lexical.js')
const assert = require('./util/assert.js')

var Scope = {
  getAll: function () {
    var ctx = {}
    for (var i = this.scopes.length - 1; i >= 0; i--) {
      _.assign(ctx, this.scopes[i])
    }
    return ctx
  },
  get: function (str) {
    if (str === 'liquid') {
      throw new Error('NO LONGER SUPPORTED: use scope.opts instead of scope.get("liquid")')
    }
    try {
      return this.getPropertyByPath(this.scopes, str)
    } catch (e) {
      if (!/undefined variable/.test(e.message) || this.opts.strict_variables) {
        throw e
      }
    }
  },
  set: function (k, v) {
    var scope = this.findScopeFor(k)
    setPropertyByPath(scope, k, v)
    return this
  },
  push: function (ctx) {
    assert(ctx, `trying to push ${ctx} into scopes`)
    return this.scopes.push(ctx)
  },
  pop: function () {
    return this.scopes.pop()
{'fraction_non_alphanumeric': 0.1613067891781521, 'fraction_numerical': 0.0030627871362940277, 'mean_word_length': 2.622920517560074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4770808', 'n_tokens_mistral': 698, 'n_tokens_neox': 677, 'n_words': 170}